CmdLine: Add --cpu-mhz to lock the emulated CPU clock

Overrides the locked CPU speed setting without saving it, so a headless run
can reproduce a game at a different frame rate.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-17 00:00:01 +02:00
1 parent 59fe760b16
commit 7e74ea90d8
2 files changed
+9

No files matched your search

+6
View File
@@ -243,6 +243,7 @@ static const CommandLineParam g_autoParams[] = {
{POFF(odsLog), CmdParamType::Bool, "odslog", 'o', "Also log through OutputDebugString (Windows)", CmdLineMode::Headless},
{POFF(generateInterpreterDispatch), CmdParamType::Bool, "generate-interpreter-dispatch", '\0', "Generate C++ interpreter dispatch code (ExecInstruction) to stdout and exit", CmdLineMode::Headless},
{POFF(resolutionScale), CmdParamType::Int, "resolution-scale", '\0', "Set the resolution scale factor"},
{POFF(lockedCPUSpeed), CmdParamType::Int, "cpu-mhz", '\0', "Lock the emulated CPU clock at this many MHz (0 = let the game set it)"},
{POFF(msaa), CmdParamType::Int, "msaa", '\0', "Set the MSAA level (0 = off, 1 = 2x, 2 = 4x, 3 = 8x)"},
{POFF(debuggerPort), CmdParamType::Int, "debugger", '\0', "Enable the WebSocket debugger on this port (0 = pick automatically); see docs/WebSocketDebugger.md"},
{POFF(debuggerRunPort), CmdParamType::Int, "debugger-run", '\0', "Like --debugger, but starts running instead of waiting at the entry point", CmdLineMode::Headless},
@@ -621,6 +622,11 @@ void CommandLineOptions::ApplyToConfig() const {
g_logManager.DoNotSaveChannels();
}
if (lockedCPUSpeed.has_value()) {
g_Config.iLockedCPUSpeed = lockedCPUSpeed.value();
g_Config.DoNotSaveSetting(&g_Config.iLockedCPUSpeed);
}
if (oldAtrac.has_value()) {
g_Config.bUseOldAtrac = oldAtrac.value();
g_Config.DoNotSaveSetting(&g_Config.bUseOldAtrac);
+3
View File
@@ -106,6 +106,9 @@ struct CommandLineOptions {
// way to compare the two without editing a config, and the way out if the real one breaks a game.
std::optional<int> forceHLE;
// Overrides g_Config.iLockedCPUSpeed, in MHz.
std::optional<int> lockedCPUSpeed;
// Headless: install the game update in a .pkg (given as the boot filename) into this
// directory, then exit without booting anything. The directory is the game folder itself -
// the app puts that under PSP/GAME/<DISC_ID>, but here the caller picks. See