From 60ddac0048fae036f4783f9a49bb4c49c2c4f596 Mon Sep 17 00:00:00 2001 From: sum2012 Date: Thu, 19 Oct 2023 06:21:05 +0800 Subject: [PATCH 1/8] Add UMDReadSpeed in compat.ini Fix #11062 --- Core/Compatibility.cpp | 1 + Core/Compatibility.h | 1 + Core/HLE/sceIo.cpp | 8 +++++++- assets/compat.ini | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Core/Compatibility.cpp b/Core/Compatibility.cpp index 58acbd7c69..2f3197bfef 100644 --- a/Core/Compatibility.cpp +++ b/Core/Compatibility.cpp @@ -133,6 +133,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) { CheckSetting(iniFile, gameID, "SOCOMClut8Replacement", &flags_.SOCOMClut8Replacement); CheckSetting(iniFile, gameID, "Fontltn12Hack", &flags_.Fontltn12Hack); CheckSetting(iniFile, gameID, "LoadCLUTFromCurrentFrameOnly", &flags_.LoadCLUTFromCurrentFrameOnly); + CheckSetting(iniFile, gameID, "UMDReadSpeed", &flags_.UMDReadSpeed); } void Compatibility::CheckVRSettings(IniFile &iniFile, const std::string &gameID) { diff --git a/Core/Compatibility.h b/Core/Compatibility.h index 1079618c87..4e5b77a699 100644 --- a/Core/Compatibility.h +++ b/Core/Compatibility.h @@ -103,6 +103,7 @@ struct CompatFlags { bool SOCOMClut8Replacement; bool Fontltn12Hack; bool LoadCLUTFromCurrentFrameOnly; + bool UMDReadSpeed; }; struct VRCompat { diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index d8599f9865..32d3dec84a 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -1585,7 +1585,13 @@ static u32 sceIoOpen(const char *filename, int flags, int mode) { } // UMD: Speed varies from 1-6ms. // Card: Path depth matters, but typically between 10-13ms on a standard Pro Duo. - int delay = pspFileSystem.FlagsFromFilename(filename) & FileSystemFlags::UMD ? 4000 : 10000; + int delay; + if (PSP_CoreParameter().compat.flags().UMDReadSpeed) { + delay = 500000; + } + else { + delay = pspFileSystem.FlagsFromFilename(filename) & FileSystemFlags::UMD ? 4000 : 10000; + } return hleLogSuccessI(SCEIO, hleDelayResult(id, "file opened", delay)); } } diff --git a/assets/compat.ini b/assets/compat.ini index 95c036e277..1b60ee2d6b 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -1639,3 +1639,8 @@ NPUA80013 = true # Demo UCUS98704 = true # Demo NPEG90002 = true # Demo SYPH04036 = true # Prototype? + +[UMDReadSpeed] +#Aces of War required slow read speed (even in Real PSP) see #11062 +ULJM05075 = true +ULES00590 = true From 079452001e5422905f822414a71adf690638ce5b Mon Sep 17 00:00:00 2001 From: sum2012 Date: Thu, 19 Oct 2023 20:51:29 +0800 Subject: [PATCH 2/8] Japanese version no need --- assets/compat.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/compat.ini b/assets/compat.ini index 1b60ee2d6b..a615d89873 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -1642,5 +1642,4 @@ SYPH04036 = true # Prototype? [UMDReadSpeed] #Aces of War required slow read speed (even in Real PSP) see #11062 -ULJM05075 = true ULES00590 = true From 92c1eb4efa7671f54a0768bcabcc66d62dc3e0d3 Mon Sep 17 00:00:00 2001 From: sum2012 Date: Mon, 23 Oct 2023 19:38:09 +0800 Subject: [PATCH 3/8] Add it to option Also fix Sengoku Musou 3Z Special DLC --- Core/Compatibility.cpp | 2 +- Core/Compatibility.h | 2 +- Core/HLE/sceIo.cpp | 2 +- UI/GameSettingsScreen.cpp | 2 +- assets/compat.ini | 4 +++- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Core/Compatibility.cpp b/Core/Compatibility.cpp index 2f3197bfef..29a8874039 100644 --- a/Core/Compatibility.cpp +++ b/Core/Compatibility.cpp @@ -133,7 +133,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) { CheckSetting(iniFile, gameID, "SOCOMClut8Replacement", &flags_.SOCOMClut8Replacement); CheckSetting(iniFile, gameID, "Fontltn12Hack", &flags_.Fontltn12Hack); CheckSetting(iniFile, gameID, "LoadCLUTFromCurrentFrameOnly", &flags_.LoadCLUTFromCurrentFrameOnly); - CheckSetting(iniFile, gameID, "UMDReadSpeed", &flags_.UMDReadSpeed); + CheckSetting(iniFile, gameID, "ForceUMDReadSpeed", &flags_.ForceUMDReadSpeed); } void Compatibility::CheckVRSettings(IniFile &iniFile, const std::string &gameID) { diff --git a/Core/Compatibility.h b/Core/Compatibility.h index 4e5b77a699..a917d17e5e 100644 --- a/Core/Compatibility.h +++ b/Core/Compatibility.h @@ -103,7 +103,7 @@ struct CompatFlags { bool SOCOMClut8Replacement; bool Fontltn12Hack; bool LoadCLUTFromCurrentFrameOnly; - bool UMDReadSpeed; + bool ForceUMDReadSpeed; }; struct VRCompat { diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 32d3dec84a..f04c8175bd 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -1586,7 +1586,7 @@ static u32 sceIoOpen(const char *filename, int flags, int mode) { // UMD: Speed varies from 1-6ms. // Card: Path depth matters, but typically between 10-13ms on a standard Pro Duo. int delay; - if (PSP_CoreParameter().compat.flags().UMDReadSpeed) { + if (PSP_CoreParameter().compat.flags().ForceUMDReadSpeed || g_Config.iIOTimingMethod == 3) { delay = 500000; } else { diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index f5216ea7e5..0a3a4cfc16 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1081,7 +1081,7 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) { systemSettings->Add(new CheckBox(&g_Config.bFastMemory, sy->T("Fast Memory", "Fast Memory")))->OnClick.Handle(this, &GameSettingsScreen::OnJitAffectingSetting); systemSettings->Add(new CheckBox(&g_Config.bIgnoreBadMemAccess, sy->T("Ignore bad memory accesses"))); - static const char *ioTimingMethods[] = { "Fast (lag on slow storage)", "Host (bugs, less lag)", "Simulate UMD delays" }; + static const char *ioTimingMethods[] = { "Fast (lag on slow storage)", "Host (bugs, less lag)", "Simulate UMD delays", "Simulate UMD slow reading speed"}; View *ioTimingMethod = systemSettings->Add(new PopupMultiChoice(&g_Config.iIOTimingMethod, sy->T("IO timing method"), ioTimingMethods, 0, ARRAY_SIZE(ioTimingMethods), I18NCat::SYSTEM, screenManager())); systemSettings->Add(new CheckBox(&g_Config.bForceLagSync, sy->T("Force real clock sync (slower, less lag)")))->SetDisabledPtr(&g_Config.bAutoFrameSkip); PopupSliderChoice *lockedMhz = systemSettings->Add(new PopupSliderChoice(&g_Config.iLockedCPUSpeed, 0, 1000, 0, sy->T("Change CPU Clock", "Change CPU Clock (unstable)"), screenManager(), sy->T("MHz, 0:default"))); diff --git a/assets/compat.ini b/assets/compat.ini index a615d89873..03a260762c 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -1640,6 +1640,8 @@ UCUS98704 = true # Demo NPEG90002 = true # Demo SYPH04036 = true # Prototype? -[UMDReadSpeed] +[ForceUMDReadSpeed] #Aces of War required slow read speed (even in Real PSP) see #11062 ULES00590 = true +#Sengoku Musou 3Z Special DLC see #9993 +ULJM06024 = true \ No newline at end of file From 6a844dd98533bbc0de0e781255b74537bdc602ae Mon Sep 17 00:00:00 2001 From: sum2012 Date: Mon, 23 Oct 2023 20:03:42 +0800 Subject: [PATCH 4/8] Add more delay as ForceUMDDelay Also add setting in libretro --- Core/ConfigValues.h | 1 + Core/HLE/sceIo.cpp | 4 ++-- libretro/libretro.cpp | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Core/ConfigValues.h b/Core/ConfigValues.h index e7a6957e5c..7d02b5c960 100644 --- a/Core/ConfigValues.h +++ b/Core/ConfigValues.h @@ -128,6 +128,7 @@ enum IOTimingMethods { IOTIMING_FAST = 0, IOTIMING_HOST = 1, IOTIMING_REALISTIC = 2, + IOTIMING_UMDSLOWREALISTIC = 3, }; enum class AutoLoadSaveState { diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index f04c8175bd..4fa5826a6d 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -341,7 +341,7 @@ static void IoAsyncCleanupThread(int fd) { } static int GetIOTimingMethod() { - if (PSP_CoreParameter().compat.flags().ForceUMDDelay) { + if (PSP_CoreParameter().compat.flags().ForceUMDDelay || PSP_CoreParameter().compat.flags().ForceUMDReadSpeed || g_Config.iIOTimingMethod == IOTIMING_UMDSLOWREALISTIC) { return IOTIMING_REALISTIC; } else { return g_Config.iIOTimingMethod; @@ -1586,7 +1586,7 @@ static u32 sceIoOpen(const char *filename, int flags, int mode) { // UMD: Speed varies from 1-6ms. // Card: Path depth matters, but typically between 10-13ms on a standard Pro Duo. int delay; - if (PSP_CoreParameter().compat.flags().ForceUMDReadSpeed || g_Config.iIOTimingMethod == 3) { + if (PSP_CoreParameter().compat.flags().ForceUMDReadSpeed || g_Config.iIOTimingMethod == IOTIMING_UMDSLOWREALISTIC) { delay = 500000; } else { diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index c5b4807750..de6792012f 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -523,6 +523,8 @@ static void check_variables(CoreParameter &coreParam) g_Config.iIOTimingMethod = IOTIMING_HOST; else if (!strcmp(var.value, "Simulate UMD delays")) g_Config.iIOTimingMethod = IOTIMING_REALISTIC; + else if (!strcmp(var.value, "Simulate UMD slow reading speed")) + g_Config.iIOTimingMethod = IOTIMING_UMDSLOWREALISTIC; } var.key = "ppsspp_force_lag_sync"; From 84d3bff507550506ee6df0f984cb97de2c4e30af Mon Sep 17 00:00:00 2001 From: sum2012 Date: Tue, 24 Oct 2023 20:06:30 +0800 Subject: [PATCH 5/8] Delay smaller --- Core/HLE/sceIo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 4fa5826a6d..4abcb208e1 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -1587,7 +1587,7 @@ static u32 sceIoOpen(const char *filename, int flags, int mode) { // Card: Path depth matters, but typically between 10-13ms on a standard Pro Duo. int delay; if (PSP_CoreParameter().compat.flags().ForceUMDReadSpeed || g_Config.iIOTimingMethod == IOTIMING_UMDSLOWREALISTIC) { - delay = 500000; + delay = 401000; } else { delay = pspFileSystem.FlagsFromFilename(filename) & FileSystemFlags::UMD ? 4000 : 10000; From aa5a3edda88e73d189ff908c986ca4d069703f8a Mon Sep 17 00:00:00 2001 From: sum2012 Date: Wed, 25 Oct 2023 05:39:51 +0800 Subject: [PATCH 6/8] Japanese version need Last time I test wrong --- assets/compat.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/compat.ini b/assets/compat.ini index 03a260762c..59909df931 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -1643,5 +1643,6 @@ SYPH04036 = true # Prototype? [ForceUMDReadSpeed] #Aces of War required slow read speed (even in Real PSP) see #11062 ULES00590 = true +ULJM05075 = true #Sengoku Musou 3Z Special DLC see #9993 ULJM06024 = true \ No newline at end of file From 8613c685eb5f933ead5ac28bb03489ccd3fbd975 Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sun, 29 Oct 2023 12:38:52 +0800 Subject: [PATCH 7/8] Change timing in __IoRead Test in Aces of War (Europe) and Sengoku Musou 3 Z Special --- Core/HLE/sceIo.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 4abcb208e1..edcde6e902 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -341,7 +341,7 @@ static void IoAsyncCleanupThread(int fd) { } static int GetIOTimingMethod() { - if (PSP_CoreParameter().compat.flags().ForceUMDDelay || PSP_CoreParameter().compat.flags().ForceUMDReadSpeed || g_Config.iIOTimingMethod == IOTIMING_UMDSLOWREALISTIC) { + if (PSP_CoreParameter().compat.flags().ForceUMDDelay) { return IOTIMING_REALISTIC; } else { return g_Config.iIOTimingMethod; @@ -1037,7 +1037,14 @@ static u32 npdrmRead(FileNode *f, u8 *data, int size) { static bool __IoRead(int &result, int id, u32 data_addr, int size, int &us) { PROFILE_THIS_SCOPE("io_rw"); // Low estimate, may be improved later from the ReadFile result. - us = size / 100; + + if (PSP_CoreParameter().compat.flags().ForceUMDReadSpeed || g_Config.iIOTimingMethod == IOTIMING_UMDSLOWREALISTIC) { + us = size / 4.2; + } + else { + us = size / 100; + } + if (us < 100) { us = 100; } @@ -1129,7 +1136,7 @@ static u32 sceIoRead(int id, u32 data_addr, int size) { int result; int us; - bool complete = __IoRead(result, id, data_addr, size, us); + bool complete = __IoRead(result, id, data_addr, size, us); if (!complete) { DEBUG_LOG(SCEIO, "sceIoRead(%d, %08x, %x): deferring result", id, data_addr, size); @@ -1585,13 +1592,7 @@ static u32 sceIoOpen(const char *filename, int flags, int mode) { } // UMD: Speed varies from 1-6ms. // Card: Path depth matters, but typically between 10-13ms on a standard Pro Duo. - int delay; - if (PSP_CoreParameter().compat.flags().ForceUMDReadSpeed || g_Config.iIOTimingMethod == IOTIMING_UMDSLOWREALISTIC) { - delay = 401000; - } - else { - delay = pspFileSystem.FlagsFromFilename(filename) & FileSystemFlags::UMD ? 4000 : 10000; - } + int delay = pspFileSystem.FlagsFromFilename(filename) & FileSystemFlags::UMD ? 4000 : 10000; return hleLogSuccessI(SCEIO, hleDelayResult(id, "file opened", delay)); } } From 7092393ed785e805159be58b08421297136ab877 Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sun, 29 Oct 2023 12:40:20 +0800 Subject: [PATCH 8/8] Space bug --- Core/HLE/sceIo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index edcde6e902..3935de7047 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -1136,7 +1136,7 @@ static u32 sceIoRead(int id, u32 data_addr, int size) { int result; int us; - bool complete = __IoRead(result, id, data_addr, size, us); + bool complete = __IoRead(result, id, data_addr, size, us); if (!complete) { DEBUG_LOG(SCEIO, "sceIoRead(%d, %08x, %x): deferring result", id, data_addr, size);