mirror of https://github.com/stella-emu/stella.git
Remove busy waiting.
This commit is contained in:
parent
50ee957a29
commit
89a6cb11d1
|
@ -686,8 +686,6 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void OSystem::mainLoop()
|
void OSystem::mainLoop()
|
||||||
{
|
{
|
||||||
// Sleep-based wait: good for CPU, bad for graphical sync
|
|
||||||
bool busyWait = mySettings->getString("timing") != "sleep";
|
|
||||||
// 6507 time
|
// 6507 time
|
||||||
time_point<high_resolution_clock> virtualTime = high_resolution_clock::now();
|
time_point<high_resolution_clock> virtualTime = high_resolution_clock::now();
|
||||||
// The emulation worker
|
// The emulation worker
|
||||||
|
@ -726,10 +724,7 @@ void OSystem::mainLoop()
|
||||||
virtualTime = now;
|
virtualTime = now;
|
||||||
else if (virtualTime > now) {
|
else if (virtualTime > now) {
|
||||||
// Wait until we have caught up with 6507 time
|
// Wait until we have caught up with 6507 time
|
||||||
if (busyWait && myEventHandler->state() == EventHandlerState::EMULATION) {
|
std::this_thread::sleep_until(virtualTime);
|
||||||
while (high_resolution_clock::now() < virtualTime);
|
|
||||||
}
|
|
||||||
else std::this_thread::sleep_until(virtualTime);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ Settings::Settings(OSystem& osystem)
|
||||||
setInternal("fullscreen", "false");
|
setInternal("fullscreen", "false");
|
||||||
setInternal("center", "false");
|
setInternal("center", "false");
|
||||||
setInternal("palette", "standard");
|
setInternal("palette", "standard");
|
||||||
setInternal("timing", "sleep");
|
|
||||||
setInternal("uimessages", "true");
|
setInternal("uimessages", "true");
|
||||||
|
|
||||||
// TIA specific options
|
// TIA specific options
|
||||||
|
@ -308,9 +307,6 @@ void Settings::validate()
|
||||||
f = getFloat("speed");
|
f = getFloat("speed");
|
||||||
if (f <= 0) setInternal("speed", "1.0");
|
if (f <= 0) setInternal("speed", "1.0");
|
||||||
|
|
||||||
s = getString("timing");
|
|
||||||
if(s != "sleep" && s != "busy") setInternal("timing", "sleep");
|
|
||||||
|
|
||||||
i = getInt("tia.aspectn");
|
i = getInt("tia.aspectn");
|
||||||
if(i < 80 || i > 120) setInternal("tia.aspectn", "90");
|
if(i < 80 || i > 120) setInternal("tia.aspectn", "90");
|
||||||
i = getInt("tia.aspectp");
|
i = getInt("tia.aspectp");
|
||||||
|
|
|
@ -215,11 +215,6 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
wid.push_back(myCenter);
|
wid.push_back(myCenter);
|
||||||
ypos += (lineHeight + VGAP) * 2;
|
ypos += (lineHeight + VGAP) * 2;
|
||||||
|
|
||||||
// Timing to use between frames
|
|
||||||
myFrameTiming = new CheckboxWidget(myTab, font, xpos, ypos + 1, "Idle between frames (*)");
|
|
||||||
wid.push_back(myFrameTiming);
|
|
||||||
ypos += lineHeight + VGAP;
|
|
||||||
|
|
||||||
// Use multi-threading
|
// Use multi-threading
|
||||||
myUseThreads = new CheckboxWidget(myTab, font, xpos, ypos + 1, "Multi-threading");
|
myUseThreads = new CheckboxWidget(myTab, font, xpos, ypos + 1, "Multi-threading");
|
||||||
wid.push_back(myUseThreads);
|
wid.push_back(myUseThreads);
|
||||||
|
@ -359,9 +354,6 @@ void VideoDialog::loadConfig()
|
||||||
// TIA interpolation
|
// TIA interpolation
|
||||||
myTIAInterpolate->setState(instance().settings().getBool("tia.inter"));
|
myTIAInterpolate->setState(instance().settings().getBool("tia.inter"));
|
||||||
|
|
||||||
// Wait between frames
|
|
||||||
myFrameTiming->setState(instance().settings().getString("timing") == "sleep");
|
|
||||||
|
|
||||||
// Aspect ratio setting (NTSC and PAL)
|
// Aspect ratio setting (NTSC and PAL)
|
||||||
myNAspectRatio->setValue(instance().settings().getInt("tia.aspectn"));
|
myNAspectRatio->setValue(instance().settings().getInt("tia.aspectn"));
|
||||||
myPAspectRatio->setValue(instance().settings().getInt("tia.aspectp"));
|
myPAspectRatio->setValue(instance().settings().getInt("tia.aspectp"));
|
||||||
|
@ -431,9 +423,6 @@ void VideoDialog::saveConfig()
|
||||||
instance().settings().setValue("palette",
|
instance().settings().setValue("palette",
|
||||||
myTIAPalette->getSelectedTag().toString());
|
myTIAPalette->getSelectedTag().toString());
|
||||||
|
|
||||||
// Wait between frames
|
|
||||||
instance().settings().setValue("timing", myFrameTiming->getState() ? "sleep" : "busy");
|
|
||||||
|
|
||||||
// TIA interpolation
|
// TIA interpolation
|
||||||
instance().settings().setValue("tia.inter", myTIAInterpolate->getState());
|
instance().settings().setValue("tia.inter", myTIAInterpolate->getState());
|
||||||
|
|
||||||
|
@ -514,7 +503,6 @@ void VideoDialog::setDefaults()
|
||||||
myRenderer->setSelectedIndex(0);
|
myRenderer->setSelectedIndex(0);
|
||||||
myTIAZoom->setSelected("3", "");
|
myTIAZoom->setSelected("3", "");
|
||||||
myTIAPalette->setSelected("standard", "");
|
myTIAPalette->setSelected("standard", "");
|
||||||
myFrameTiming->setState(true);
|
|
||||||
myTIAInterpolate->setState(false);
|
myTIAInterpolate->setState(false);
|
||||||
myNAspectRatio->setValue(91);
|
myNAspectRatio->setValue(91);
|
||||||
myPAspectRatio->setValue(109);
|
myPAspectRatio->setValue(109);
|
||||||
|
|
|
@ -54,7 +54,6 @@ class VideoDialog : public Dialog
|
||||||
PopUpWidget* myRenderer;
|
PopUpWidget* myRenderer;
|
||||||
PopUpWidget* myTIAZoom; // TODO: SliderWidget
|
PopUpWidget* myTIAZoom; // TODO: SliderWidget
|
||||||
PopUpWidget* myTIAPalette;
|
PopUpWidget* myTIAPalette;
|
||||||
CheckboxWidget* myFrameTiming;
|
|
||||||
CheckboxWidget* myTIAInterpolate;
|
CheckboxWidget* myTIAInterpolate;
|
||||||
SliderWidget* myNAspectRatio;
|
SliderWidget* myNAspectRatio;
|
||||||
SliderWidget* myPAspectRatio;
|
SliderWidget* myPAspectRatio;
|
||||||
|
|
Loading…
Reference in New Issue