added 'Turbo" mode

This commit is contained in:
thrust26 2020-04-19 23:08:25 +02:00
parent 4aed2e454a
commit bdb685644d
11 changed files with 77 additions and 25 deletions

View File

@ -22,7 +22,9 @@
a game. This allows the user to save high scores for these games. For each a game. This allows the user to save high scores for these games. For each
game and variation, the top 10 scores can be saved. (TODO: Doc) game and variation, the top 10 scores can be saved. (TODO: Doc)
* Add option which lets default ROM path follow launcher navigation (TODO: Doc) * Added 'Turbo' mode, runs the game as fast as the computer allows.
* Added option which lets default ROM path follow launcher navigation (TODO: Doc)
* Added displaying last write address in the debugger. * Added displaying last write address in the debugger.

View File

@ -1626,6 +1626,12 @@
<td>Control + i</td> <td>Control + i</td>
</tr> </tr>
<tr>
<td>Toggle 'Turbo' mode</td>
<td>Control + t</td>
<td>Control + t</td>
</tr>
<tr> <tr>
<td>Toggle sound on/off</td> <td>Toggle sound on/off</td>
<td>Control + ]</td> <td>Control + ]</td>
@ -2004,6 +2010,11 @@
<td>Control the emulation speed (as a percentage, 10 - 1000).</td> <td>Control the emulation speed (as a percentage, 10 - 1000).</td>
</tr> </tr>
<tr>
<td><pre>-turbo &lt;1|0&gt;</pre></td>
<td>Enable 'Turbo' mode for maximum emulation speed.</td>
</tr>
<tr> <tr>
<td><pre>-uimessages &lt;1|0&gt;</pre></td> <td><pre>-uimessages &lt;1|0&gt;</pre></td>
<td>Enable or disable display of message in the UI. Note that messages <td>Enable or disable display of message in the UI. Note that messages
@ -2063,29 +2074,29 @@
<td>Set the pitch o f Pitfall II music.</td> <td>Set the pitch o f Pitfall II music.</td>
</tr> </tr>
<tr> <tr>
<td><pre>-tia.zoom &lt;zoom&gt;</pre></td> <td><pre>-tia.zoom &lt;zoom&gt;</pre></td>
<td>Use the specified zoom level (integer) while in TIA/emulation mode. <td>Use the specified zoom level (integer) while in TIA/emulation mode.
</td> </td>
</tr> </tr>
<tr> <tr>
<td><pre>-tia.vsizeadjust &lt;-5 - 5&gt;</pre></td> <td><pre>-tia.vsizeadjust &lt;-5 - 5&gt;</pre></td>
<td>Adjust the display height of the TIA image <td>Adjust the display height of the TIA image
</td> </td>
</tr> </tr>
<tr> <tr>
<td><pre>-tia.inter &lt;1|0&gt;</pre></td> <td><pre>-tia.inter &lt;1|0&gt;</pre></td>
<td>Use interpolation for the TIA image (results in blending/smoothing <td>Use interpolation for the TIA image (results in blending/smoothing
of the image).</td> of the image).</td>
</tr> </tr>
<tr> <tr>
<td><pre>-tia.fs_stretch &lt;1|0&gt;</pre></td> <td><pre>-tia.fs_stretch &lt;1|0&gt;</pre></td>
<td>Stretch TIA image completely while in fullscreen mode, vs. keeping the correct <td>Stretch TIA image completely while in fullscreen mode, vs. keeping the correct
aspect ratio.</td> aspect ratio.</td>
</tr> </tr>
<tr> <tr>
<td><pre>-tia.fs_overscan &lt;0 - 10&gt;</pre></td> <td><pre>-tia.fs_overscan &lt;0 - 10&gt;</pre></td>

View File

@ -320,7 +320,8 @@ bool FrameBufferSDL2::setVideoMode(const string& title, const VideoMode& mode)
} }
uInt32 renderFlags = SDL_RENDERER_ACCELERATED; uInt32 renderFlags = SDL_RENDERER_ACCELERATED;
if(myOSystem.settings().getBool("vsync")) // V'synced blits option if(myOSystem.settings().getBool("vsync")
&& !myOSystem.settings().getBool("turbo")) // V'synced blits option
renderFlags |= SDL_RENDERER_PRESENTVSYNC; renderFlags |= SDL_RENDERER_PRESENTVSYNC;
const string& video = myOSystem.settings().getString("video"); // Render hint const string& video = myOSystem.settings().getString("video"); // Render hint
if(video != "") if(video != "")

View File

@ -468,6 +468,7 @@ PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultCommo
{Event::ToggleColorLoss, KBDK_L, KBDM_CTRL}, {Event::ToggleColorLoss, KBDK_L, KBDM_CTRL},
{Event::TogglePalette, KBDK_P, KBDM_CTRL}, {Event::TogglePalette, KBDK_P, KBDM_CTRL},
{Event::ToggleInter, KBDK_I, KBDM_CTRL}, {Event::ToggleInter, KBDK_I, KBDM_CTRL},
{Event::ToggleTurbo, KBDK_T, KBDM_CTRL},
{Event::ToggleJitter, KBDK_J, MOD3}, {Event::ToggleJitter, KBDK_J, MOD3},
{Event::ToggleFrameStats, KBDK_L, MOD3}, {Event::ToggleFrameStats, KBDK_L, MOD3},
{Event::ToggleTimeMachine, KBDK_T, MOD3}, {Event::ToggleTimeMachine, KBDK_T, MOD3},

View File

@ -563,6 +563,24 @@ void Console::toggleInter()
myOSystem.frameBuffer().showMessage(ss.str()); myOSystem.frameBuffer().showMessage(ss.str());
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::toggleTurbo()
{
bool enabled = myOSystem.settings().getBool("turbo");
myOSystem.settings().setValue("turbo", !enabled);
// update speed
initializeAudio();
// update VSync
myOSystem.createFrameBuffer();
ostringstream ss;
ss << "Turbo mode " << (!enabled ? "enabled" : "disabled");
myOSystem.frameBuffer().showMessage(ss.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::togglePhosphor() void Console::togglePhosphor()
{ {
@ -657,7 +675,9 @@ void Console::initializeAudio()
.updatePlaybackPeriod(myAudioSettings.fragmentSize()) .updatePlaybackPeriod(myAudioSettings.fragmentSize())
.updateAudioQueueExtraFragments(myAudioSettings.bufferSize()) .updateAudioQueueExtraFragments(myAudioSettings.bufferSize())
.updateAudioQueueHeadroom(myAudioSettings.headroom()) .updateAudioQueueHeadroom(myAudioSettings.headroom())
.updateSpeedFactor(myOSystem.settings().getFloat("speed")); .updateSpeedFactor(myOSystem.settings().getBool("turbo")
? 20.0F
: myOSystem.settings().getFloat("speed"));
createAudioQueue(); createAudioQueue();
myTIA->setAudioQueue(myAudioQueue); myTIA->setAudioQueue(myAudioQueue);

View File

@ -221,6 +221,11 @@ class Console : public Serializable, public ConsoleIO
*/ */
void toggleInter(); void toggleInter();
/**
Toggle turbo mode on/off
*/
void toggleTurbo();
/** /**
Toggles phosphor effect. Toggles phosphor effect.

View File

@ -120,6 +120,7 @@ class Event
ToggleFrameStats, ToggleSAPortOrder, ExitGame, ToggleFrameStats, ToggleSAPortOrder, ExitGame,
// add new events from here to avoid that user remapped events get overwritten // add new events from here to avoid that user remapped events get overwritten
ToggleTurbo,
LastType LastType
}; };

View File

@ -539,6 +539,10 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
if (pressed && !repeated) myOSystem.console().toggleInter(); if (pressed && !repeated) myOSystem.console().toggleInter();
return; return;
case Event::ToggleTurbo:
if (pressed && !repeated) myOSystem.console().toggleTurbo();
return;
case Event::ToggleJitter: case Event::ToggleJitter:
if (pressed && !repeated) myOSystem.console().toggleJitter(); if (pressed && !repeated) myOSystem.console().toggleJitter();
return; return;
@ -1815,6 +1819,7 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
{ Event::TogglePauseMode, "Toggle Pause mode", "" }, { Event::TogglePauseMode, "Toggle Pause mode", "" },
{ Event::StartPauseMode, "Start Pause mode", "" }, { Event::StartPauseMode, "Start Pause mode", "" },
{ Event::Fry, "Fry cartridge", "" }, { Event::Fry, "Fry cartridge", "" },
{ Event::ToggleTurbo, "Toggle Turbo mode", "" },
{ Event::DebuggerMode, "Toggle Debugger mode", "" }, { Event::DebuggerMode, "Toggle Debugger mode", "" },
{ Event::ConsoleSelect, "Select", "" }, { Event::ConsoleSelect, "Select", "" },
@ -2023,6 +2028,7 @@ EventHandler::MenuActionList EventHandler::ourMenuActionList = { {
const Event::EventSet EventHandler::MiscEvents = { const Event::EventSet EventHandler::MiscEvents = {
Event::Quit, Event::ReloadConsole, Event::Fry, Event::StartPauseMode, Event::Quit, Event::ReloadConsole, Event::Fry, Event::StartPauseMode,
Event::TogglePauseMode, Event::OptionsMenuMode, Event::CmdMenuMode, Event::ExitMode, Event::TogglePauseMode, Event::OptionsMenuMode, Event::CmdMenuMode, Event::ExitMode,
Event::ToggleTurbo,
Event::TakeSnapshot, Event::ToggleContSnapshots, Event::ToggleContSnapshotsFrame, Event::TakeSnapshot, Event::ToggleContSnapshots, Event::ToggleContSnapshotsFrame,
// Event::MouseAxisXMove, Event::MouseAxisYMove, // Event::MouseAxisXMove, Event::MouseAxisYMove,
// Event::MouseButtonLeftValue, Event::MouseButtonRightValue, // Event::MouseButtonLeftValue, Event::MouseButtonRightValue,

View File

@ -468,7 +468,7 @@ class EventHandler
#else #else
PNG_SIZE = 0, PNG_SIZE = 0,
#endif #endif
EMUL_ACTIONLIST_SIZE = 144 + PNG_SIZE + COMBO_SIZE, EMUL_ACTIONLIST_SIZE = 145 + PNG_SIZE + COMBO_SIZE,
MENU_ACTIONLIST_SIZE = 18 MENU_ACTIONLIST_SIZE = 18
; ;

View File

@ -502,7 +502,10 @@ void FrameBuffer::drawFrameStats(float framesPerSecond)
ss ss
<< std::fixed << std::setprecision(1) << framesPerSecond << std::fixed << std::setprecision(1) << framesPerSecond
<< "fps @ " << "fps @ "
<< std::fixed << std::setprecision(0) << 100 * myOSystem.settings().getFloat("speed") << std::fixed << std::setprecision(0) << 100 *
(myOSystem.settings().getBool("turbo")
? 20.0F
: myOSystem.settings().getFloat("speed"))
<< "% speed"; << "% speed";
myStatsMsg.surface->drawString(f, ss.str(), xPos, yPos, myStatsMsg.surface->drawString(f, ss.str(), xPos, yPos,

View File

@ -157,6 +157,7 @@ Settings::Settings()
setPermanent("threads", "false"); setPermanent("threads", "false");
setTemporary("romloadcount", "0"); setTemporary("romloadcount", "0");
setTemporary("maxres", ""); setTemporary("maxres", "");
setTemporary("turbo", "0");
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
// Debugger/disassembly options // Debugger/disassembly options
@ -400,6 +401,7 @@ void Settings::usage() const
<< " z26|\n" << " z26|\n"
<< " user>\n" << " user>\n"
<< " -speed <number> Run emulation at the given speed\n" << " -speed <number> Run emulation at the given speed\n"
<< " -turbo <1|0> Enable 'Turbo' mode for maximum emulation speed\n"
<< " -uimessages <1|0> Show onscreen UI messages for different events\n" << " -uimessages <1|0> Show onscreen UI messages for different events\n"
<< endl << endl
#ifdef SOUND_SUPPORT #ifdef SOUND_SUPPORT