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
This commit is contained in:
bgk 2008-09-13 10:17:34 +00:00
parent 3852562980
commit f1415efc9e
4 changed files with 0 additions and 244 deletions

View File

@ -387,78 +387,6 @@
<property name="use_underline">True</property> <property name="use_underline">True</property>
<child> <child>
<widget class="GtkMenu" id="FrameskipMenu_menu"> <widget class="GtkMenu" id="FrameskipMenu_menu">
<child>
<widget class="GtkMenuItem" id="ThrottleMenu">
<property name="visible">True</property>
<property name="label" translatable="yes">_Throttle</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="ThrottleMenu_menu">
<child>
<widget class="GtkRadioMenuItem" id="ThrottleNoThrottle">
<property name="visible">True</property>
<property name="label" translatable="yes">_No throttle</property>
<property name="use_underline">True</property>
<property name="active">True</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="Throttle25">
<property name="visible">True</property>
<property name="label" translatable="yes">25%</property>
<property name="use_underline">True</property>
<property name="group">ThrottleNoThrottle</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="Throttle50">
<property name="visible">True</property>
<property name="label" translatable="yes">50%</property>
<property name="use_underline">True</property>
<property name="group">ThrottleNoThrottle</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="Throttle100">
<property name="visible">True</property>
<property name="label" translatable="yes">100%</property>
<property name="use_underline">True</property>
<property name="group">ThrottleNoThrottle</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="Throttle150">
<property name="visible">True</property>
<property name="label" translatable="yes">150%</property>
<property name="use_underline">True</property>
<property name="group">ThrottleNoThrottle</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="Throttle200">
<property name="visible">True</property>
<property name="label" translatable="yes">200%</property>
<property name="use_underline">True</property>
<property name="group">ThrottleNoThrottle</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="ThrottleOther">
<property name="visible">True</property>
<property name="label" translatable="yes">_Other...</property>
<property name="use_underline">True</property>
<property name="group">ThrottleNoThrottle</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator19">
<property name="visible">True</property>
</widget>
</child>
<child> <child>
<widget class="GtkRadioMenuItem" id="FrameskipAutomatic"> <widget class="GtkRadioMenuItem" id="FrameskipAutomatic">
<property name="visible">True</property> <property name="visible">True</property>

View File

@ -82,8 +82,6 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
m_iGBAScreenHeight(160), m_iGBAScreenHeight(160),
m_iFrameskipMin (0), m_iFrameskipMin (0),
m_iFrameskipMax (9), m_iFrameskipMax (9),
m_iThrottleMin (5),
m_iThrottleMax (1000),
m_iScaleMin (1), m_iScaleMin (1),
m_iScaleMax (6), m_iScaleMax (6),
m_iShowSpeedMin (ShowNone), m_iShowSpeedMin (ShowNone),
@ -316,42 +314,6 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
poCMI, astFrameskip[i].m_iFrameskip)); 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<Gtk::CheckMenuItem *>(_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<int>("throttle");
for (guint i = 0; i < G_N_ELEMENTS(astThrottle); i++)
{
poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_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 // Video menu
// //
struct struct
@ -938,7 +900,6 @@ void Window::vInitConfig()
m_poCoreConfig = m_oConfig.poAddSection("Core"); m_poCoreConfig = m_oConfig.poAddSection("Core");
m_poCoreConfig->vSetKey("load_game_auto", false ); m_poCoreConfig->vSetKey("load_game_auto", false );
m_poCoreConfig->vSetKey("frameskip", "auto" ); m_poCoreConfig->vSetKey("frameskip", "auto" );
m_poCoreConfig->vSetKey("throttle", 0 );
m_poCoreConfig->vSetKey("layer_bg0", true ); m_poCoreConfig->vSetKey("layer_bg0", true );
m_poCoreConfig->vSetKey("layer_bg1", true ); m_poCoreConfig->vSetKey("layer_bg1", true );
m_poCoreConfig->vSetKey("layer_bg2", true ); m_poCoreConfig->vSetKey("layer_bg2", true );
@ -1047,16 +1008,6 @@ void Window::vCheckConfig()
} }
} }
iValue = m_poCoreConfig->oGetKey<int>("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"); sValue = m_poCoreConfig->sGetKey("bios_file");
if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_REGULAR)) if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_REGULAR))
{ {
@ -1318,7 +1269,6 @@ bool Window::bLoadROM(const std::string & _rsFile)
emulating = 1; emulating = 1;
m_bWasEmulating = false; m_bWasEmulating = false;
m_uiThrottleDelay = Glib::TimeVal(0, 0);
if (m_eCartridge == CartridgeGBA) if (m_eCartridge == CartridgeGBA)
{ {
@ -1422,21 +1372,6 @@ void Window::vComputeFrameskip(int _iRate)
{ {
int iWantedSpeed = 100; 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) if (m_bAutoFrameskip)
{ {
Glib::TimeVal uiDiff = uiTime - uiLastTime; Glib::TimeVal uiDiff = uiTime - uiLastTime;
@ -1487,7 +1422,6 @@ void Window::vComputeFrameskip(int _iRate)
} }
uiLastTime = uiTime; uiLastTime = uiTime;
m_uiThrottleLastTime = uiTime;
} }
void Window::vCaptureScreen(int _iNum) void Window::vCaptureScreen(int _iNum)
@ -1633,39 +1567,6 @@ void Window::vStopEmu()
m_bWasEmulating = false; 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<Gtk::CheckMenuItem *>(m_poXml->get_widget(astThrottle[i].m_csName));
if (astThrottle[i].m_iThrottle == systemThrottle)
{
poCMI->set_active();
}
}
}
void Window::vUpdateGameSlots() void Window::vUpdateGameSlots()
{ {
if (m_eCartridge == CartridgeNone) if (m_eCartridge == CartridgeNone)

View File

@ -143,8 +143,6 @@ protected:
virtual void vOnFileClose(); virtual void vOnFileClose();
virtual void vOnFileExit(); virtual void vOnFileExit();
virtual void vOnFrameskipToggled(Gtk::CheckMenuItem * _poCMI, int _iValue); 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 vOnVideoFullscreen();
virtual void vOnVideoOutputToggled(Gtk::CheckMenuItem * _poCMI, int _iOutput); virtual void vOnVideoOutputToggled(Gtk::CheckMenuItem * _poCMI, int _iOutput);
virtual void vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale); virtual void vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale);
@ -180,8 +178,6 @@ private:
// Config limits // Config limits
const int m_iFrameskipMin; const int m_iFrameskipMin;
const int m_iFrameskipMax; const int m_iFrameskipMax;
const int m_iThrottleMin;
const int m_iThrottleMax;
const int m_iScaleMin; const int m_iScaleMin;
const int m_iScaleMax; const int m_iScaleMax;
const int m_iShowSpeedMin; const int m_iShowSpeedMin;
@ -261,8 +257,6 @@ private:
bool m_bPaused; bool m_bPaused;
bool m_bWasEmulating; bool m_bWasEmulating;
bool m_bAutoFrameskip; bool m_bAutoFrameskip;
Glib::TimeVal m_uiThrottleLastTime;
Glib::TimeVal m_uiThrottleDelay;
EShowSpeed m_eShowSpeed; EShowSpeed m_eShowSpeed;
ESoundQuality m_eSoundQuality; ESoundQuality m_eSoundQuality;
@ -285,8 +279,6 @@ private:
void vSaveBattery(); void vSaveBattery();
void vStartEmu(); void vStartEmu();
void vStopEmu(); void vStopEmu();
void vSetThrottle(int _iPercent);
void vSelectBestThrottleItem();
void vUpdateGameSlots(); void vUpdateGameSlots();
void vToggleFullscreen(); void vToggleFullscreen();
void vSDLPollEvents(); void vSDLPollEvents();

View File

@ -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<Xml> poXml;
poXml = Xml::create(PKGDATADIR "/vba.glade", "ThrottleDialog");
Gtk::Dialog * poDialog = dynamic_cast<Gtk::Dialog *>(poXml->get_widget("ThrottleDialog"));
Gtk::SpinButton * poSpin = dynamic_cast<Gtk::SpinButton *>(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() void Window::vOnVideoFullscreen()
{ {
vToggleFullscreen(); vToggleFullscreen();
@ -936,22 +887,6 @@ void Window::vOnHelpAbout()
bool Window::bOnEmuIdle() 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(); vSDLPollEvents();
m_stEmulator.emuMain(m_stEmulator.emuCount); m_stEmulator.emuMain(m_stEmulator.emuCount);