From f1415efc9e799993d5a1289a3083612f54fb3695 Mon Sep 17 00:00:00 2001 From: bgk Date: Sat, 13 Sep 2008 10:17:34 +0000 Subject: [PATCH] GTK : Removed throttle support. It was broken, and IMO not so useful. git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@714 a31d4220-a93d-0410-bf67-fe4944624d44 --- src/gtk/vba.glade | 72 --------------------------- src/gtk/window.cpp | 99 ------------------------------------- src/gtk/window.h | 8 --- src/gtk/windowcallbacks.cpp | 65 ------------------------ 4 files changed, 244 deletions(-) diff --git a/src/gtk/vba.glade b/src/gtk/vba.glade index ffe7a178..b735de53 100644 --- a/src/gtk/vba.glade +++ b/src/gtk/vba.glade @@ -387,78 +387,6 @@ True - - - True - _Throttle - True - - - - - True - _No throttle - True - True - - - - - True - 25% - True - ThrottleNoThrottle - - - - - True - 50% - True - ThrottleNoThrottle - - - - - True - 100% - True - ThrottleNoThrottle - - - - - True - 150% - True - ThrottleNoThrottle - - - - - True - 200% - True - ThrottleNoThrottle - - - - - True - _Other... - True - ThrottleNoThrottle - - - - - - - - - True - - True diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 91f7a6ba..1cf1b631 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -82,8 +82,6 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr & _poXml) : m_iGBAScreenHeight(160), m_iFrameskipMin (0), m_iFrameskipMax (9), - m_iThrottleMin (5), - m_iThrottleMax (1000), m_iScaleMin (1), m_iScaleMax (6), m_iShowSpeedMin (ShowNone), @@ -316,42 +314,6 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr & _poXml) : poCMI, astFrameskip[i].m_iFrameskip)); } - // Throttle menu - // - struct - { - const char * m_csName; - const int m_iThrottle; - } - astThrottle[] = - { - { "ThrottleNoThrottle", 0 }, - { "Throttle25", 25 }, - { "Throttle50", 50 }, - { "Throttle100", 100 }, - { "Throttle150", 150 }, - { "Throttle200", 200 } - }; - poCMI = dynamic_cast(_poXml->get_widget("ThrottleOther")); - poCMI->set_active(); - poCMI->signal_activate().connect(sigc::bind( - sigc::mem_fun(*this, &Window::vOnThrottleOther), - poCMI)); - - int iDefaultThrottle = m_poCoreConfig->oGetKey("throttle"); - for (guint i = 0; i < G_N_ELEMENTS(astThrottle); i++) - { - poCMI = dynamic_cast(_poXml->get_widget(astThrottle[i].m_csName)); - if (astThrottle[i].m_iThrottle == iDefaultThrottle) - { - poCMI->set_active(); - } - poCMI->signal_toggled().connect(sigc::bind( - sigc::mem_fun(*this, &Window::vOnThrottleToggled), - poCMI, astThrottle[i].m_iThrottle)); - } - vSetThrottle(iDefaultThrottle); - // Video menu // struct @@ -938,7 +900,6 @@ void Window::vInitConfig() m_poCoreConfig = m_oConfig.poAddSection("Core"); m_poCoreConfig->vSetKey("load_game_auto", false ); m_poCoreConfig->vSetKey("frameskip", "auto" ); - m_poCoreConfig->vSetKey("throttle", 0 ); m_poCoreConfig->vSetKey("layer_bg0", true ); m_poCoreConfig->vSetKey("layer_bg1", true ); m_poCoreConfig->vSetKey("layer_bg2", true ); @@ -1047,16 +1008,6 @@ void Window::vCheckConfig() } } - iValue = m_poCoreConfig->oGetKey("throttle"); - if (iValue != 0) - { - iAdjusted = CLAMP(iValue, m_iThrottleMin, m_iThrottleMax); - if (iValue != iAdjusted) - { - m_poCoreConfig->vSetKey("throttle", iAdjusted); - } - } - sValue = m_poCoreConfig->sGetKey("bios_file"); if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_REGULAR)) { @@ -1318,7 +1269,6 @@ bool Window::bLoadROM(const std::string & _rsFile) emulating = 1; m_bWasEmulating = false; - m_uiThrottleDelay = Glib::TimeVal(0, 0); if (m_eCartridge == CartridgeGBA) { @@ -1422,21 +1372,6 @@ void Window::vComputeFrameskip(int _iRate) { int iWantedSpeed = 100; - if (systemThrottle > 0) - { - if (! speedup) - { - Glib::TimeVal uiDiff = uiTime - m_uiThrottleLastTime; - Glib::TimeVal iTarget = Glib::TimeVal(0, 1000 / (_iRate * systemThrottle)); - Glib::TimeVal iDelay = iTarget - uiDiff; - if (iDelay > Glib::TimeVal(0, 0)) - { - m_uiThrottleDelay = iDelay; - } - } - iWantedSpeed = systemThrottle; - } - if (m_bAutoFrameskip) { Glib::TimeVal uiDiff = uiTime - uiLastTime; @@ -1487,7 +1422,6 @@ void Window::vComputeFrameskip(int _iRate) } uiLastTime = uiTime; - m_uiThrottleLastTime = uiTime; } void Window::vCaptureScreen(int _iNum) @@ -1633,39 +1567,6 @@ void Window::vStopEmu() m_bWasEmulating = false; } -void Window::vSetThrottle(int _iPercent) -{ - systemThrottle = _iPercent; - m_poCoreConfig->vSetKey("throttle", _iPercent); -} - -void Window::vSelectBestThrottleItem() -{ - struct - { - const char * m_csName; - const int m_iThrottle; - } - astThrottle[] = - { - { "ThrottleNoThrottle", 0 }, - { "Throttle25", 25 }, - { "Throttle50", 50 }, - { "Throttle100", 100 }, - { "Throttle150", 150 }, - { "Throttle200", 200 } - }; - for (guint i = 0; i < G_N_ELEMENTS(astThrottle); i++) - { - Gtk::CheckMenuItem * poCMI; - poCMI = dynamic_cast(m_poXml->get_widget(astThrottle[i].m_csName)); - if (astThrottle[i].m_iThrottle == systemThrottle) - { - poCMI->set_active(); - } - } -} - void Window::vUpdateGameSlots() { if (m_eCartridge == CartridgeNone) diff --git a/src/gtk/window.h b/src/gtk/window.h index 43e6e662..1b2bd4e3 100644 --- a/src/gtk/window.h +++ b/src/gtk/window.h @@ -143,8 +143,6 @@ protected: virtual void vOnFileClose(); virtual void vOnFileExit(); virtual void vOnFrameskipToggled(Gtk::CheckMenuItem * _poCMI, int _iValue); - virtual void vOnThrottleToggled(Gtk::CheckMenuItem * _poCMI, int _iPercent); - virtual void vOnThrottleOther(Gtk::CheckMenuItem * _poCMI); virtual void vOnVideoFullscreen(); virtual void vOnVideoOutputToggled(Gtk::CheckMenuItem * _poCMI, int _iOutput); virtual void vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale); @@ -180,8 +178,6 @@ private: // Config limits const int m_iFrameskipMin; const int m_iFrameskipMax; - const int m_iThrottleMin; - const int m_iThrottleMax; const int m_iScaleMin; const int m_iScaleMax; const int m_iShowSpeedMin; @@ -261,8 +257,6 @@ private: bool m_bPaused; bool m_bWasEmulating; bool m_bAutoFrameskip; - Glib::TimeVal m_uiThrottleLastTime; - Glib::TimeVal m_uiThrottleDelay; EShowSpeed m_eShowSpeed; ESoundQuality m_eSoundQuality; @@ -285,8 +279,6 @@ private: void vSaveBattery(); void vStartEmu(); void vStopEmu(); - void vSetThrottle(int _iPercent); - void vSelectBestThrottleItem(); void vUpdateGameSlots(); void vToggleFullscreen(); void vSDLPollEvents(); diff --git a/src/gtk/windowcallbacks.cpp b/src/gtk/windowcallbacks.cpp index dc69b734..09c1430a 100644 --- a/src/gtk/windowcallbacks.cpp +++ b/src/gtk/windowcallbacks.cpp @@ -497,55 +497,6 @@ void Window::vOnFrameskipToggled(Gtk::CheckMenuItem * _poCMI, int _iValue) } } -void Window::vOnThrottleToggled(Gtk::CheckMenuItem * _poCMI, int _iPercent) -{ - if (! _poCMI->get_active()) - { - return; - } - - vSetThrottle(_iPercent); - - // Initialize the frameskip adjustment each time throttle is changed - if (m_bAutoFrameskip) - { - systemFrameSkip = 0; - } -} - -void Window::vOnThrottleOther(Gtk::CheckMenuItem * _poCMI) -{ - if (! _poCMI->get_active()) - { - return; - } - - Glib::RefPtr poXml; - poXml = Xml::create(PKGDATADIR "/vba.glade", "ThrottleDialog"); - - Gtk::Dialog * poDialog = dynamic_cast(poXml->get_widget("ThrottleDialog")); - Gtk::SpinButton * poSpin = dynamic_cast(poXml->get_widget("ThrottleSpin")); - - poDialog->set_transient_for(*this); - - if (systemThrottle != 0) - { - poSpin->set_value(systemThrottle); - } - else - { - poSpin->set_value(100); - } - - if (poDialog->run() == Gtk::RESPONSE_OK) - { - vSetThrottle(poSpin->get_value_as_int()); - } - - delete poDialog; - vSelectBestThrottleItem(); -} - void Window::vOnVideoFullscreen() { vToggleFullscreen(); @@ -936,22 +887,6 @@ void Window::vOnHelpAbout() bool Window::bOnEmuIdle() { - if (m_uiThrottleDelay != Glib::TimeVal(0, 0)) - { - Glib::TimeVal uiTime; - uiTime.assign_current_time(); - - if (uiTime - m_uiThrottleLastTime >= m_uiThrottleDelay) - { - m_uiThrottleDelay = Glib::TimeVal(0, 0); - m_uiThrottleLastTime = uiTime; - } - else - { - return true; - } - } - vSDLPollEvents(); m_stEmulator.emuMain(m_stEmulator.emuCount);