add Soft Reset action

This commit is contained in:
gen2brain 2013-06-07 20:04:12 +02:00
parent c9c9475603
commit 86467e958e
5 changed files with 38 additions and 9 deletions

View file

@ -469,10 +469,10 @@ class Core:
log.warn(self.error_message(rval))
return rval
def reset(self):
def reset(self, soft=False):
"""Reset the emulated machine."""
rval = self.m64p.CoreDoCommand(
M64CMD_RESET, C.c_int(1))
M64CMD_RESET, C.c_int(int(soft)))
if rval != M64ERR_SUCCESS:
log.debug("reset()")
log.warn(self.error_message(rval))

View file

@ -275,6 +275,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.actionMute.setEnabled(action)
self.actionStop.setEnabled(action)
self.actionReset.setEnabled(action)
self.actionSoftReset.setEnabled(action)
self.actionLimitFPS.setEnabled(action)
self.actionSlowDown.setEnabled(action)
self.actionSpeedUp.setEnabled(action)
@ -395,6 +396,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
"""Resets emulator."""
self.worker.reset()
@pyqtSignature("")
def on_actionSoftReset_triggered(self):
"""Resets emulator."""
self.worker.reset(True)
@pyqtSignature("")
def on_actionLimitFPS_triggered(self):
"""Toggles speed limit."""

View file

@ -219,9 +219,9 @@ class Worker(QThread):
"""Sends key up event."""
self.m64p.send_sdl_keyup(key)
def reset(self):
def reset(self, soft=False):
"""Resets emulator."""
self.m64p.reset()
self.m64p.reset(soft)
def speed_up(self):
"""Speeds up emulator."""

View file

@ -118,6 +118,7 @@
<addaction name="separator"/>
<addaction name="actionStop"/>
<addaction name="actionReset"/>
<addaction name="actionSoftReset"/>
<addaction name="separator"/>
<addaction name="actionLimitFPS"/>
<addaction name="separator"/>
@ -563,7 +564,7 @@ QStatusBar { margin:0px; }</string>
<normaloff>:/icons/action_state_load.png</normaloff>:/icons/action_state_load.png</iconset>
</property>
<property name="text">
<string>Load From...</string>
<string>Load State...</string>
</property>
</action>
<action name="actionSaveAs">
@ -575,7 +576,7 @@ QStatusBar { margin:0px; }</string>
<normaloff>:/icons/action_state_save.png</normaloff>:/icons/action_state_save.png</iconset>
</property>
<property name="text">
<string>Save As...</string>
<string>Save State As...</string>
</property>
</action>
<action name="actionLimitFPS">
@ -592,6 +593,21 @@ QStatusBar { margin:0px; }</string>
<string>Limit FPS</string>
</property>
</action>
<action name="actionSoftReset">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/action_reset.png</normaloff>:/icons/action_reset.png</iconset>
</property>
<property name="text">
<string>Sof&amp;t Reset</string>
</property>
<property name="shortcut">
<string>F8</string>
</property>
</action>
</widget>
<resources>
<include location="images.qrc"/>

View file

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'mainwindow.ui'
#
# Created: Fri Jun 7 16:09:00 2013
# Created: Fri Jun 7 18:55:40 2013
# by: PyQt4 UI code generator 4.10.1
#
# WARNING! All changes made in this file will be lost!
@ -253,6 +253,10 @@ class Ui_MainWindow(object):
self.actionLimitFPS.setChecked(True)
self.actionLimitFPS.setEnabled(False)
self.actionLimitFPS.setObjectName(_fromUtf8("actionLimitFPS"))
self.actionSoftReset = QtGui.QAction(MainWindow)
self.actionSoftReset.setEnabled(False)
self.actionSoftReset.setIcon(icon15)
self.actionSoftReset.setObjectName(_fromUtf8("actionSoftReset"))
self.menuLoad.addAction(self.actionManually)
self.menuLoad.addAction(self.actionFromList)
self.menuFile.addAction(self.menuLoad.menuAction())
@ -280,6 +284,7 @@ class Ui_MainWindow(object):
self.menuEmulation.addSeparator()
self.menuEmulation.addAction(self.actionStop)
self.menuEmulation.addAction(self.actionReset)
self.menuEmulation.addAction(self.actionSoftReset)
self.menuEmulation.addSeparator()
self.menuEmulation.addAction(self.actionLimitFPS)
self.menuEmulation.addSeparator()
@ -361,9 +366,11 @@ class Ui_MainWindow(object):
self.actionSpeedUp.setShortcut(_translate("MainWindow", "F11", None))
self.actionCheats.setText(_translate("MainWindow", "Cheats...", None))
self.actionCheats.setShortcut(_translate("MainWindow", "F2", None))
self.actionLoadFrom.setText(_translate("MainWindow", "Load From...", None))
self.actionSaveAs.setText(_translate("MainWindow", "Save As...", None))
self.actionLoadFrom.setText(_translate("MainWindow", "Load State...", None))
self.actionSaveAs.setText(_translate("MainWindow", "Save State As...", None))
self.actionLimitFPS.setText(_translate("MainWindow", "Limit FPS", None))
self.actionSoftReset.setText(_translate("MainWindow", "Sof&t Reset", None))
self.actionSoftReset.setShortcut(_translate("MainWindow", "F8", None))
import images_rc
import icons_rc