Compat: Force realistic UMD timing for F1 2006. Fixes #9193 but not the game, since there's also #11177.

This commit is contained in:
Henrik Rydgard 2019-02-06 10:45:12 +01:00
parent 210e84869f
commit 3d114c5bca
4 changed files with 25 additions and 7 deletions

View File

@ -61,6 +61,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) {
CheckSetting(iniFile, gameID, "SonicRivalsHack", &flags_.SonicRivalsHack);
CheckSetting(iniFile, gameID, "BlockTransferAllowCreateFB", &flags_.BlockTransferAllowCreateFB);
CheckSetting(iniFile, gameID, "YugiohSaveFix", &flags_.YugiohSaveFix);
CheckSetting(iniFile, gameID, "ForceUMDDelay", &flags_.ForceUMDDelay);
}
void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, bool *flag) {

View File

@ -61,6 +61,7 @@ struct CompatFlags {
bool SonicRivalsHack;
bool BlockTransferAllowCreateFB;
bool YugiohSaveFix;
bool ForceUMDDelay;
};
class IniFile;

View File

@ -253,6 +253,14 @@ public:
u64 __IoCompleteAsyncIO(FileNode *f);
static int GetIOTimingMethod() {
if (PSP_CoreParameter().compat.flags().ForceUMDDelay) {
return IOTIMING_REALISTIC;
} else {
return g_Config.iIOTimingMethod;
}
}
static void TellFsThreadEnded (SceUID threadID) {
pspFileSystem.ThreadEnded(threadID);
}
@ -339,7 +347,8 @@ static void __IoAsyncNotify(u64 userdata, int cyclesLate) {
return;
}
if (g_Config.iIOTimingMethod == IOTIMING_HOST) {
int ioTimingMethod = GetIOTimingMethod();
if (ioTimingMethod == IOTIMING_HOST) {
// Not all async operations actually queue up. Maybe should separate them?
if (!ioManager.HasResult(f->handle) && ioManager.HasOperation(f->handle)) {
// Try again in another 0.5ms until the IO completes on the host.
@ -347,7 +356,7 @@ static void __IoAsyncNotify(u64 userdata, int cyclesLate) {
return;
}
__IoCompleteAsyncIO(f);
} else if (g_Config.iIOTimingMethod == IOTIMING_REALISTIC) {
} else if (ioTimingMethod == IOTIMING_REALISTIC) {
u64 finishTicks = __IoCompleteAsyncIO(f);
if (finishTicks > CoreTiming::GetTicks()) {
// Reschedule for later, since we now know how long it ought to take.
@ -396,13 +405,14 @@ static void __IoSyncNotify(u64 userdata, int cyclesLate) {
return;
}
if (g_Config.iIOTimingMethod == IOTIMING_HOST) {
int ioTimingMethod = GetIOTimingMethod();
if (ioTimingMethod == IOTIMING_HOST) {
if (!ioManager.HasResult(f->handle)) {
// Try again in another 0.5ms until the IO completes on the host.
CoreTiming::ScheduleEvent(usToCycles(500) - cyclesLate, syncNotifyEvent, userdata);
return;
}
} else if (g_Config.iIOTimingMethod == IOTIMING_REALISTIC) {
} else if (ioTimingMethod == IOTIMING_REALISTIC) {
u64 finishTicks = ioManager.ResultFinishTicks(f->handle);
if (finishTicks > CoreTiming::GetTicks()) {
// Reschedule for later when the result should finish.
@ -723,7 +733,8 @@ static u32 sceKernelStderr() {
u64 __IoCompleteAsyncIO(FileNode *f) {
PROFILE_THIS_SCOPE("io_rw");
if (g_Config.iIOTimingMethod == IOTIMING_REALISTIC) {
int ioTimingMethod = GetIOTimingMethod();
if (ioTimingMethod == IOTIMING_REALISTIC) {
u64 finishTicks = ioManager.ResultFinishTicks(f->handle);
if (finishTicks > CoreTiming::GetTicks()) {
return finishTicks;
@ -921,7 +932,7 @@ static bool __IoRead(int &result, int id, u32 data_addr, int size, int &us) {
ioManager.ScheduleOperation(ev);
return false;
} else {
if (g_Config.iIOTimingMethod != IOTIMING_REALISTIC) {
if (GetIOTimingMethod() != IOTIMING_REALISTIC) {
result = (int) pspFileSystem.ReadFile(f->handle, data, size);
} else {
result = (int) pspFileSystem.ReadFile(f->handle, data, size, us);
@ -1056,7 +1067,7 @@ static bool __IoWrite(int &result, int id, u32 data_addr, int size, int &us) {
ioManager.ScheduleOperation(ev);
return false;
} else {
if (g_Config.iIOTimingMethod != IOTIMING_REALISTIC) {
if (GetIOTimingMethod() != IOTIMING_REALISTIC) {
result = (int) pspFileSystem.WriteFile(f->handle, (u8 *) data_ptr, size);
} else {
result = (int) pspFileSystem.WriteFile(f->handle, (u8 *) data_ptr, size, us);

View File

@ -384,3 +384,8 @@ ULJM05940 = true
# Yu-Gi-Oh! ARC-V Tag Force Special
NPJH00142 = true
[ForceUMDDelay]
# F1 2006
UCES00238 = true
UCJS10045 = true