Skip to content

Commit

Permalink
Merge pull request #18369 from sum2012/UmdReadSpeed
Browse files Browse the repository at this point in the history
Add Simulate UMD slow reading speed in UI
  • Loading branch information
hrydgard committed Nov 3, 2023
2 parents ede0f09 + 7092393 commit 70999dc
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions Core/Compatibility.cpp
Expand Up @@ -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, "ForceUMDReadSpeed", &flags_.ForceUMDReadSpeed);
}

void Compatibility::CheckVRSettings(IniFile &iniFile, const std::string &gameID) {
Expand Down
1 change: 1 addition & 0 deletions Core/Compatibility.h
Expand Up @@ -103,6 +103,7 @@ struct CompatFlags {
bool SOCOMClut8Replacement;
bool Fontltn12Hack;
bool LoadCLUTFromCurrentFrameOnly;
bool ForceUMDReadSpeed;
};

struct VRCompat {
Expand Down
1 change: 1 addition & 0 deletions Core/ConfigValues.h
Expand Up @@ -128,6 +128,7 @@ enum IOTimingMethods {
IOTIMING_FAST = 0,
IOTIMING_HOST = 1,
IOTIMING_REALISTIC = 2,
IOTIMING_UMDSLOWREALISTIC = 3,
};

enum class AutoLoadSaveState {
Expand Down
9 changes: 8 additions & 1 deletion Core/HLE/sceIo.cpp
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion UI/GameSettingsScreen.cpp
Expand Up @@ -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")));
Expand Down
7 changes: 7 additions & 0 deletions assets/compat.ini
Expand Up @@ -1639,3 +1639,10 @@ NPUA80013 = true # Demo
UCUS98704 = true # Demo
NPEG90002 = true # Demo
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
2 changes: 2 additions & 0 deletions libretro/libretro.cpp
Expand Up @@ -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";
Expand Down

0 comments on commit 70999dc

Please sign in to comment.