diff --git a/Src/Model3/Model3.cpp b/Src/Model3/Model3.cpp index c8b26ca..1d98306 100644 --- a/Src/Model3/Model3.cpp +++ b/Src/Model3/Model3.cpp @@ -2041,21 +2041,42 @@ ThreadError: m_multiThreaded = false; } +static unsigned GetCPUClockFrequencyInHz(const Game &game, Util::Config::Node &config) +{ + unsigned mhz = config["PowerPCFrequency"].ValueAsDefault(0); + if (!mhz) + { + if (game.stepping == "1.0") + { + mhz = 66; + } + else if (game.stepping == "1.5") + { + mhz = 100; + } + else // 2.x + { + mhz = 166; + } + } + return mhz * 1000000; +} + void CModel3::RunMainBoardFrame(void) { UINT32 start = CThread::GetTicks(); /* - * Compute display timings. Refresh rate is 57.524160 Hz and we assume frame timing is the same as System 24: + * Compute display timings. Refresh rate is 57.524160 Hz and we assume frame timing is the same as System 24: + * + * - 25 scanlines from /VSYNC high to /BLANK high (top border) + * - 384 scanlines from /BLANK high to /BLANK low (active display) + * - 11 scanlines from /BLANK low to /VSYNC low (bottom border) + * - 4 scanlines from /VSYNC low to /VSYNC high (vertical sync. pulse) * - * - 25 scanlines from /VSYNC high to /BLANK high (top border) - * - 384 scanlines from /BLANK high to /BLANK low (active display) - * - 11 scanlines from /BLANK low to /VSYNC low (bottom border) - * - 4 scanlines from /VSYNC low to /VSYNC high (vertical sync. pulse) - * - * 424 lines total: 384 display and 40 blanking/vsync. + * 424 lines total: 384 display and 40 blanking/vsync. */ - unsigned ppcCycles = m_config["PowerPCFrequency"].ValueAs() * 1000000; + unsigned ppcCycles = GetCPUClockFrequencyInHz(m_game, m_config); unsigned frameCycles = (unsigned)((float)ppcCycles / 57.524160f); unsigned lineCycles = frameCycles / 424; unsigned dispCycles = lineCycles * (TileGen.ReadRegister(0x08) + 40); diff --git a/Src/OSD/SDL/Main.cpp b/Src/OSD/SDL/Main.cpp index 9b28034..dc37b66 100644 --- a/Src/OSD/SDL/Main.cpp +++ b/Src/OSD/SDL/Main.cpp @@ -1456,7 +1456,6 @@ static Util::Config::Node DefaultConfig() // CModel3 config.Set("MultiThreaded", true); config.Set("GPUMultiThreaded", true); - config.Set("PowerPCFrequency", "50"); // 2D and 3D graphics engines config.Set("MultiTexture", false); config.Set("VertexShader", ""); @@ -1561,7 +1560,7 @@ static void Help(void) puts(" -log-level= Logging threshold [Default: info]"); puts(""); puts("Core Options:"); - printf(" -ppc-frequency= PowerPC frequency in MHz [Default: %d]\n", defaultConfig["PowerPCFrequency"].ValueAs()); + puts(" -ppc-frequency= PowerPC frequency (default varies by stepping)"); puts(" -no-threads Disable multi-threading entirely"); puts(" -gpu-multi-threaded Run graphics rendering in separate thread [Default]"); puts(" -no-gpu-thread Run graphics rendering in main thread");