change PSX framerates to follow mednafen instead of nocash (fixes #2138)

This commit is contained in:
zeromus 2020-06-15 15:10:20 -04:00
parent e6a2fe39e1
commit 98b3d8d335
2 changed files with 43 additions and 23 deletions

View File

@ -46,6 +46,7 @@ namespace BizHawk.Client.Common
// while the number of scanlines per frame is software controlled and variable, we
// enforce exactly 262 (NTSC) 312 (PAL) per reference time frame
["A26"] = 315000000.0 / 88.0 / 262.0 / 228.0, // 59.922751013550531429197560173856
// this pal clock ref is exact
["A26_PAL"] = 3546895.0 / 312.0 / 228.0, // 49.860759671614934772829509671615
@ -53,8 +54,11 @@ namespace BizHawk.Client.Common
["Coleco"] = 59.9227510135505,
// according to http://problemkaputt.de/psx-spx.htm
["PSX"] = 44100.0 * 768 * 11 / 7 / 263 / 3413, // 59.292862562
["PSX_PAL"] = 44100.0 * 768 * 11 / 7 / 314 / 3406, // 49.7645593576
//["PSX"] = 44100.0 * 768 * 11 / 7 / 263 / 3413, // 59.292862562
//["PSX_PAL"] = 44100.0 * 768 * 11 / 7 / 314 / 3406, // 49.7645593576
// according to https://github.com/TASVideos/mednafen/blob/740d63996fc7cebffd39ee253a29ee434965db21/src/psx/gpu.cpp
["PSX"] = 502813668.0 / 8388608, //59.940060138702392578125
["PSX_PAL"] = 419432765.0 / 8388608, //50.00028192996978759765625
["C64_PAL"] = PALCarrier * 2 / 9 / 312 / 63,
["C64_NTSC"] = NTSCCarrier * 2 / 7 / 263 / 65,
@ -64,15 +68,6 @@ namespace BizHawk.Client.Common
["ZXSpectrum_PAL"] = 50.080128205,
["AmstradCPC_PAL"] = 50.08012820512821,
// according to ryphecha, using
// clocks[2] = { 53.693182e06, 53.203425e06 }; //ntsc console, pal console
// lpf[2][2] = { { 263, 262.5 }, { 314, 312.5 } }; //ntsc,pal; non-interlaced, interlaced
// cpl[2] = { 3412.5, 3405 }; //ntsc mode, pal mode
// PAL PS1: 0, PAL Mode: 0, Interlaced: 0 --- 59.826106 (53.693182e06/(263*3412.5))
// PAL PS1: 0, PAL Mode: 0, Interlaced: 1 --- 59.940060 (53.693182e06/(262.5*3412.5))
// PAL PS1: 1, PAL Mode: 1, Interlaced: 0 --- 49.761427 (53.203425e06/(314*3405))
// PAL PS1: 1, PAL Mode: 1, Interlaced: 1 --- 50.000282(53.203425e06/(312.5*3405))
};
public double this[string systemId, bool pal]

View File

@ -102,22 +102,47 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
SystemRegion = discInfo.region;
}
//see http://problemkaputt.de/psx-spx.htm
int CpuClock_n = 44100 * 768;
int CpuClock_d = 1;
int VidClock_n = CpuClock_n * 11;
int VidClock_d = CpuClock_d * 7;
if (SystemRegion == OctoshockDll.eRegion.EU)
bool use_nocash_specs = false;
if (use_nocash_specs)
{
VsyncNumerator = VidClock_n;
VsyncDenominator = VidClock_d * 314 * 3406;
SystemVidStandard = OctoshockDll.eVidStandard.PAL;
//see http://problemkaputt.de/psx-spx.htm
int CpuClock_n = 44100 * 768;
int CpuClock_d = 1;
int VidClock_n = CpuClock_n * 11;
int VidClock_d = CpuClock_d * 7;
if (SystemRegion == OctoshockDll.eRegion.EU)
{
VsyncNumerator = VidClock_n;
VsyncDenominator = VidClock_d * 314 * 3406;
SystemVidStandard = OctoshockDll.eVidStandard.PAL;
}
else
{
VsyncNumerator = VidClock_n;
VsyncDenominator = VidClock_d * 263 * 3413;
SystemVidStandard = OctoshockDll.eVidStandard.NTSC;
}
}
else
{
VsyncNumerator = VidClock_n;
VsyncDenominator = VidClock_d * 263 * 3413;
SystemVidStandard = OctoshockDll.eVidStandard.NTSC;
//use mednafen specs
if (SystemRegion == OctoshockDll.eRegion.EU)
{
//https://github.com/TASVideos/mednafen/blob/740d63996fc7cebffd39ee253a29ee434965db21/src/psx/gpu.cpp#L175
// -> 838865530 / 65536 / 256 -> reduced
VsyncNumerator = 419432765;
VsyncDenominator = 8388608;
SystemVidStandard = OctoshockDll.eVidStandard.PAL;
}
else
{
//https://github.com/TASVideos/mednafen/blob/740d63996fc7cebffd39ee253a29ee434965db21/src/psx/gpu.cpp#L183
//-> 1005627336 / 65536 / 256 -> reduced
VsyncNumerator = 502813668;
VsyncDenominator = 8388608;
SystemVidStandard = OctoshockDll.eVidStandard.NTSC;
}
}
//TODO - known bad firmwares are a no-go. we should refuse to boot them. (that's the mednafen policy)