mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 13:47:57 +03:00
Allow specification of EE clock scale in arcadedef.
This commit is contained in:
parent
047aa16773
commit
00d53fe1f9
8 changed files with 39 additions and 10 deletions
|
@ -174,6 +174,13 @@ void CPS2VM::DestroySoundHandler()
|
|||
m_mailBox.SendCall([this]() { DestroySoundHandlerImpl(); }, true);
|
||||
}
|
||||
|
||||
void CPS2VM::SetEeFrequencyScale(uint32 numerator, uint32 denominator)
|
||||
{
|
||||
m_eeFreqScaleNumerator = numerator;
|
||||
m_eeFreqScaleDenominator = denominator;
|
||||
ReloadFrameRateLimit();
|
||||
}
|
||||
|
||||
void CPS2VM::ReloadFrameRateLimit()
|
||||
{
|
||||
uint32 frameRate = 60;
|
||||
|
@ -184,7 +191,11 @@ void CPS2VM::ReloadFrameRateLimit()
|
|||
bool limitFrameRate = CAppConfig::GetInstance().GetPreferenceBoolean(PREF_PS2_LIMIT_FRAMERATE);
|
||||
m_frameLimiter.SetFrameRate(limitFrameRate ? frameRate : 0);
|
||||
|
||||
uint32 frameTicks = PS2::EE_CLOCK_FREQ / frameRate;
|
||||
//At 1x scale, IOP runs 8 times slower than EE
|
||||
uint32 eeFreqScaled = PS2::EE_CLOCK_FREQ * m_eeFreqScaleNumerator / m_eeFreqScaleDenominator;
|
||||
m_iopTickStep = (m_eeTickStep / 8) * m_eeFreqScaleDenominator / m_eeFreqScaleNumerator;
|
||||
|
||||
uint32 frameTicks = eeFreqScaled / frameRate;
|
||||
m_onScreenTicksTotal = frameTicks * 9 / 10;
|
||||
m_vblankTicksTotal = frameTicks / 10;
|
||||
}
|
||||
|
@ -444,6 +455,8 @@ void CPS2VM::ResetVM()
|
|||
|
||||
CDROM0_SyncPath();
|
||||
|
||||
SetEeFrequencyScale(1, 1);
|
||||
|
||||
m_vblankTicks = m_onScreenTicksTotal;
|
||||
m_inVblank = false;
|
||||
|
||||
|
@ -899,10 +912,8 @@ void CPS2VM::EmuThread()
|
|||
}
|
||||
}
|
||||
|
||||
//EE CPU is 8 times faster than the IOP CPU
|
||||
static const int tickStep = 4800;
|
||||
m_eeExecutionTicks += tickStep;
|
||||
m_iopExecutionTicks += tickStep / 8;
|
||||
m_eeExecutionTicks += m_eeTickStep;
|
||||
m_iopExecutionTicks += m_iopTickStep;
|
||||
|
||||
UpdateEe();
|
||||
UpdateIop();
|
||||
|
|
|
@ -70,6 +70,7 @@ public:
|
|||
void CDROM0_SyncPath();
|
||||
void CDROM0_Reset();
|
||||
|
||||
void SetEeFrequencyScale(uint32, uint32);
|
||||
void ReloadFrameRateLimit();
|
||||
|
||||
static fs::path GetStateDirectoryPath();
|
||||
|
@ -149,6 +150,8 @@ private:
|
|||
STATUS m_nStatus = PAUSED;
|
||||
bool m_nEnd = false;
|
||||
|
||||
uint32 m_eeFreqScaleNumerator = 1;
|
||||
uint32 m_eeFreqScaleDenominator = 1;
|
||||
uint32 m_onScreenTicksTotal = 0;
|
||||
uint32 m_vblankTicksTotal = 0;
|
||||
int m_vblankTicks = 0;
|
||||
|
@ -156,6 +159,8 @@ private:
|
|||
int m_spuUpdateTicks = SPU_UPDATE_TICKS;
|
||||
int m_eeExecutionTicks = 0;
|
||||
int m_iopExecutionTicks = 0;
|
||||
static const int m_eeTickStep = 4800;
|
||||
int m_iopTickStep = 0;
|
||||
CFrameLimiter m_frameLimiter;
|
||||
|
||||
CPU_UTILISATION_INFO m_cpuUtilisation;
|
||||
|
|
|
@ -34,6 +34,8 @@ struct ARCADE_MACHINE_DEF
|
|||
std::map<unsigned int, PS2::CControllerInfo::BUTTON> buttons;
|
||||
bool hasLightGun = false;
|
||||
std::array<float, 4> lightGunXform = {65535, 0, 65535, 0};
|
||||
uint32 eeFreqScaleNumerator = 1;
|
||||
uint32 eeFreqScaleDenominator = 1;
|
||||
std::string boot;
|
||||
std::vector<PATCH> patches;
|
||||
};
|
||||
|
@ -151,6 +153,15 @@ ARCADE_MACHINE_DEF ReadArcadeMachineDefinition(const fs::path& arcadeDefPath)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(defJson.contains("eeFrequencyScale"))
|
||||
{
|
||||
auto eeFreqScaleArray = defJson["eeFrequencyScale"];
|
||||
if(eeFreqScaleArray.is_array() && (eeFreqScaleArray.size() >= 2))
|
||||
{
|
||||
def.eeFreqScaleNumerator = eeFreqScaleArray[0];
|
||||
def.eeFreqScaleDenominator = eeFreqScaleArray[1];
|
||||
}
|
||||
}
|
||||
def.boot = defJson["boot"];
|
||||
if(defJson.contains("patches"))
|
||||
{
|
||||
|
@ -258,6 +269,8 @@ void PrepareArcadeEnvironment(CPS2VM* virtualMachine, const ARCADE_MACHINE_DEF&
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtualMachine->SetEeFrequencyScale(def.eeFreqScaleNumerator, def.eeFreqScaleDenominator);
|
||||
}
|
||||
|
||||
void ApplyPatchesFromArcadeDefinition(CPS2VM* virtualMachine, const ARCADE_MACHINE_DEF& def)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
},
|
||||
"hasLightGun": true,
|
||||
"lightGunXform": [ -65535, 0, 65535, 0 ],
|
||||
"eeFrequencyScale": [4, 3],
|
||||
"boot": "ac0:CBRLOAD",
|
||||
"patches":
|
||||
[
|
||||
|
@ -22,11 +23,6 @@
|
|||
"address": "0x001003CC",
|
||||
"value": "0x0805DDB0",
|
||||
"description": "Wait for Vblank after signaling Vblank sema"
|
||||
},
|
||||
{
|
||||
"address": "0x002FABAC",
|
||||
"value": "0x0",
|
||||
"description": "Disable clock check"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
{
|
||||
"name": "gnx100-1na-a.chd"
|
||||
},
|
||||
"eeFrequencyScale": [3, 2],
|
||||
"boot": "ac0:GNXLOAD",
|
||||
"patches":
|
||||
[
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
{
|
||||
"name": "te51-dvd0.chd"
|
||||
},
|
||||
"eeFrequencyScale": [4, 3],
|
||||
"boot": "ac0:TK5LOAD",
|
||||
"patches":
|
||||
[
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
{
|
||||
"name": "ted1dvd0b.chd"
|
||||
},
|
||||
"eeFrequencyScale": [4, 3],
|
||||
"boot": "ac0:T55LOAD",
|
||||
"patches":
|
||||
[
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
{
|
||||
"name": "tsf1-ha.chd"
|
||||
},
|
||||
"eeFrequencyScale": [3, 2],
|
||||
"boot": "ac0:TC4LOAD",
|
||||
"patches":
|
||||
[
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue