diff --git a/src/m64py/frontend/mainwindow.py b/src/m64py/frontend/mainwindow.py index 002490a..1a08f21 100644 --- a/src/m64py/frontend/mainwindow.py +++ b/src/m64py/frontend/mainwindow.py @@ -275,6 +275,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.actionMute.setEnabled(action) self.actionStop.setEnabled(action) self.actionReset.setEnabled(action) + self.actionLimitFPS.setEnabled(action) self.actionSlowDown.setEnabled(action) self.actionSpeedUp.setEnabled(action) self.actionFullscreen.setEnabled(action) @@ -299,6 +300,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.stack.setCurrentWidget(self.view) self.actionMute.setChecked(False) self.actionPause.setChecked(False) + self.actionLimitFPS.setChecked(True) self.on_set_caption("M64Py") self.update_status("ROM closed.") del self.cheats @@ -393,6 +395,11 @@ class MainWindow(QMainWindow, Ui_MainWindow): """Resets emulator.""" self.worker.reset() + @pyqtSignature("") + def on_actionLimitFPS_triggered(self): + """Toggles speed limit.""" + self.worker.toggle_speed_limit() + @pyqtSignature("") def on_actionSlowDown_triggered(self): """Speeds down emulator.""" diff --git a/src/m64py/frontend/worker.py b/src/m64py/frontend/worker.py index 102ac3b..97844c2 100644 --- a/src/m64py/frontend/worker.py +++ b/src/m64py/frontend/worker.py @@ -264,6 +264,15 @@ class Worker(QThread): else: self.core_state_set(M64CORE_AUDIO_MUTE, 1) + def toggle_speed_limit(self): + """Toggles speed limiter.""" + if self.core_state_query(M64CORE_SPEED_LIMITER): + self.core_state_set(M64CORE_SPEED_LIMITER, 0) + log.info("Speed limiter disabled") + else: + self.core_state_set(M64CORE_SPEED_LIMITER, 1) + log.info("Speed limiter enabled") + def toggle_actions(self): """Toggles actions state.""" self.state = self.core_state_query(M64CORE_EMU_STATE) diff --git a/src/m64py/ui/mainwindow.ui b/src/m64py/ui/mainwindow.ui index d2b6514..5d77221 100644 --- a/src/m64py/ui/mainwindow.ui +++ b/src/m64py/ui/mainwindow.ui @@ -119,6 +119,8 @@ + + @@ -576,6 +578,20 @@ QStatusBar { margin:0px; } Save As... + + + true + + + true + + + false + + + Limit FPS + + diff --git a/src/m64py/ui/mainwindow_ui.py b/src/m64py/ui/mainwindow_ui.py index cce4d0b..d1072e2 100644 --- a/src/m64py/ui/mainwindow_ui.py +++ b/src/m64py/ui/mainwindow_ui.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'mainwindow.ui' # -# Created: Fri Jun 7 14:15:00 2013 +# Created: Fri Jun 7 16:09:00 2013 # by: PyQt4 UI code generator 4.10.1 # # WARNING! All changes made in this file will be lost! @@ -248,6 +248,11 @@ class Ui_MainWindow(object): self.actionSaveAs.setEnabled(False) self.actionSaveAs.setIcon(icon9) self.actionSaveAs.setObjectName(_fromUtf8("actionSaveAs")) + self.actionLimitFPS = QtGui.QAction(MainWindow) + self.actionLimitFPS.setCheckable(True) + self.actionLimitFPS.setChecked(True) + self.actionLimitFPS.setEnabled(False) + self.actionLimitFPS.setObjectName(_fromUtf8("actionLimitFPS")) self.menuLoad.addAction(self.actionManually) self.menuLoad.addAction(self.actionFromList) self.menuFile.addAction(self.menuLoad.menuAction()) @@ -276,6 +281,8 @@ class Ui_MainWindow(object): self.menuEmulation.addAction(self.actionStop) self.menuEmulation.addAction(self.actionReset) self.menuEmulation.addSeparator() + self.menuEmulation.addAction(self.actionLimitFPS) + self.menuEmulation.addSeparator() self.menuEmulation.addAction(self.actionSlowDown) self.menuEmulation.addAction(self.actionSpeedUp) self.menuEmulation.addSeparator() @@ -356,6 +363,7 @@ class Ui_MainWindow(object): self.actionCheats.setShortcut(_translate("MainWindow", "F2", None)) self.actionLoadFrom.setText(_translate("MainWindow", "Load From...", None)) self.actionSaveAs.setText(_translate("MainWindow", "Save As...", None)) + self.actionLimitFPS.setText(_translate("MainWindow", "Limit FPS", None)) import images_rc import icons_rc