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)) log.warn(self.error_message(rval))
return rval return rval
def reset(self): def reset(self, soft=False):
"""Reset the emulated machine.""" """Reset the emulated machine."""
rval = self.m64p.CoreDoCommand( rval = self.m64p.CoreDoCommand(
M64CMD_RESET, C.c_int(1)) M64CMD_RESET, C.c_int(int(soft)))
if rval != M64ERR_SUCCESS: if rval != M64ERR_SUCCESS:
log.debug("reset()") log.debug("reset()")
log.warn(self.error_message(rval)) log.warn(self.error_message(rval))

View file

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

View file

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

View file

@ -118,6 +118,7 @@
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionStop"/> <addaction name="actionStop"/>
<addaction name="actionReset"/> <addaction name="actionReset"/>
<addaction name="actionSoftReset"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionLimitFPS"/> <addaction name="actionLimitFPS"/>
<addaction name="separator"/> <addaction name="separator"/>
@ -563,7 +564,7 @@ QStatusBar { margin:0px; }</string>
<normaloff>:/icons/action_state_load.png</normaloff>:/icons/action_state_load.png</iconset> <normaloff>:/icons/action_state_load.png</normaloff>:/icons/action_state_load.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Load From...</string> <string>Load State...</string>
</property> </property>
</action> </action>
<action name="actionSaveAs"> <action name="actionSaveAs">
@ -575,7 +576,7 @@ QStatusBar { margin:0px; }</string>
<normaloff>:/icons/action_state_save.png</normaloff>:/icons/action_state_save.png</iconset> <normaloff>:/icons/action_state_save.png</normaloff>:/icons/action_state_save.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Save As...</string> <string>Save State As...</string>
</property> </property>
</action> </action>
<action name="actionLimitFPS"> <action name="actionLimitFPS">
@ -592,6 +593,21 @@ QStatusBar { margin:0px; }</string>
<string>Limit FPS</string> <string>Limit FPS</string>
</property> </property>
</action> </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> </widget>
<resources> <resources>
<include location="images.qrc"/> <include location="images.qrc"/>

View file

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'mainwindow.ui' # 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 # by: PyQt4 UI code generator 4.10.1
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -253,6 +253,10 @@ class Ui_MainWindow(object):
self.actionLimitFPS.setChecked(True) self.actionLimitFPS.setChecked(True)
self.actionLimitFPS.setEnabled(False) self.actionLimitFPS.setEnabled(False)
self.actionLimitFPS.setObjectName(_fromUtf8("actionLimitFPS")) 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.actionManually)
self.menuLoad.addAction(self.actionFromList) self.menuLoad.addAction(self.actionFromList)
self.menuFile.addAction(self.menuLoad.menuAction()) self.menuFile.addAction(self.menuLoad.menuAction())
@ -280,6 +284,7 @@ class Ui_MainWindow(object):
self.menuEmulation.addSeparator() self.menuEmulation.addSeparator()
self.menuEmulation.addAction(self.actionStop) self.menuEmulation.addAction(self.actionStop)
self.menuEmulation.addAction(self.actionReset) self.menuEmulation.addAction(self.actionReset)
self.menuEmulation.addAction(self.actionSoftReset)
self.menuEmulation.addSeparator() self.menuEmulation.addSeparator()
self.menuEmulation.addAction(self.actionLimitFPS) self.menuEmulation.addAction(self.actionLimitFPS)
self.menuEmulation.addSeparator() self.menuEmulation.addSeparator()
@ -361,9 +366,11 @@ class Ui_MainWindow(object):
self.actionSpeedUp.setShortcut(_translate("MainWindow", "F11", None)) self.actionSpeedUp.setShortcut(_translate("MainWindow", "F11", None))
self.actionCheats.setText(_translate("MainWindow", "Cheats...", None)) self.actionCheats.setText(_translate("MainWindow", "Cheats...", None))
self.actionCheats.setShortcut(_translate("MainWindow", "F2", None)) self.actionCheats.setShortcut(_translate("MainWindow", "F2", None))
self.actionLoadFrom.setText(_translate("MainWindow", "Load From...", None)) self.actionLoadFrom.setText(_translate("MainWindow", "Load State...", None))
self.actionSaveAs.setText(_translate("MainWindow", "Save As...", None)) self.actionSaveAs.setText(_translate("MainWindow", "Save State As...", None))
self.actionLimitFPS.setText(_translate("MainWindow", "Limit FPS", 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 images_rc
import icons_rc import icons_rc