PowerPC frequency determined by board stepping, config option is now just an override

This commit is contained in:
Bart Trzynadlowski 2024-01-28 21:08:12 -08:00
parent 620a581227
commit e59ecea32d
2 changed files with 30 additions and 10 deletions

View file

@ -2041,6 +2041,27 @@ ThreadError:
m_multiThreaded = false; m_multiThreaded = false;
} }
static unsigned GetCPUClockFrequencyInHz(const Game &game, Util::Config::Node &config)
{
unsigned mhz = config["PowerPCFrequency"].ValueAsDefault<unsigned>(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) void CModel3::RunMainBoardFrame(void)
{ {
UINT32 start = CThread::GetTicks(); UINT32 start = CThread::GetTicks();
@ -2055,7 +2076,7 @@ void CModel3::RunMainBoardFrame(void)
* *
* 424 lines total: 384 display and 40 blanking/vsync. * 424 lines total: 384 display and 40 blanking/vsync.
*/ */
unsigned ppcCycles = m_config["PowerPCFrequency"].ValueAs<unsigned>() * 1000000; unsigned ppcCycles = GetCPUClockFrequencyInHz(m_game, m_config);
unsigned frameCycles = (unsigned)((float)ppcCycles / 57.524160f); unsigned frameCycles = (unsigned)((float)ppcCycles / 57.524160f);
unsigned lineCycles = frameCycles / 424; unsigned lineCycles = frameCycles / 424;
unsigned dispCycles = lineCycles * (TileGen.ReadRegister(0x08) + 40); unsigned dispCycles = lineCycles * (TileGen.ReadRegister(0x08) + 40);

View file

@ -1456,7 +1456,6 @@ static Util::Config::Node DefaultConfig()
// CModel3 // CModel3
config.Set("MultiThreaded", true); config.Set("MultiThreaded", true);
config.Set("GPUMultiThreaded", true); config.Set("GPUMultiThreaded", true);
config.Set("PowerPCFrequency", "50");
// 2D and 3D graphics engines // 2D and 3D graphics engines
config.Set("MultiTexture", false); config.Set("MultiTexture", false);
config.Set("VertexShader", ""); config.Set("VertexShader", "");
@ -1561,7 +1560,7 @@ static void Help(void)
puts(" -log-level=<level> Logging threshold [Default: info]"); puts(" -log-level=<level> Logging threshold [Default: info]");
puts(""); puts("");
puts("Core Options:"); puts("Core Options:");
printf(" -ppc-frequency=<freq> PowerPC frequency in MHz [Default: %d]\n", defaultConfig["PowerPCFrequency"].ValueAs<unsigned>()); puts(" -ppc-frequency=<mhz> PowerPC frequency (default varies by stepping)");
puts(" -no-threads Disable multi-threading entirely"); puts(" -no-threads Disable multi-threading entirely");
puts(" -gpu-multi-threaded Run graphics rendering in separate thread [Default]"); puts(" -gpu-multi-threaded Run graphics rendering in separate thread [Default]");
puts(" -no-gpu-thread Run graphics rendering in main thread"); puts(" -no-gpu-thread Run graphics rendering in main thread");