Add a consistent feature check - only desktops get to use CacheFullISOInRAM.

This commit is contained in:
Henrik Rydgård 2025-03-27 01:02:28 +01:00
parent 8d9b3f28f2
commit b05d6171d4
6 changed files with 30 additions and 11 deletions

View file

@ -219,6 +219,8 @@ enum SystemProperty {
SYSPROP_CAN_READ_BATTERY_PERCENTAGE, SYSPROP_CAN_READ_BATTERY_PERCENTAGE,
SYSPROP_BATTERY_PERCENTAGE, SYSPROP_BATTERY_PERCENTAGE,
SYSPROP_ENOUGH_RAM_FOR_FULL_ISO,
}; };
enum class SystemNotification { enum class SystemNotification {

View file

@ -21,6 +21,7 @@
#include "Common/Thread/ThreadUtil.h" #include "Common/Thread/ThreadUtil.h"
#include "Common/TimeUtil.h" #include "Common/TimeUtil.h"
#include "Common/Log.h"
#include "Core/FileLoaders/RamCachingFileLoader.h" #include "Core/FileLoaders/RamCachingFileLoader.h"
// Takes ownership of backend. // Takes ownership of backend.
@ -91,6 +92,7 @@ void RamCachingFileLoader::InitCache() {
// Overallocate for the last block. // Overallocate for the last block.
cache_ = (u8 *)malloc((size_t)blockCount << BLOCK_SHIFT); cache_ = (u8 *)malloc((size_t)blockCount << BLOCK_SHIFT);
if (cache_ == nullptr) { if (cache_ == nullptr) {
ERROR_LOG(Log::IO, "Failed to allocate cache for Cache full ISO in RAM! Will fall back to regular reads.");
return; return;
} }
aheadRemaining_ = blockCount; aheadRemaining_ = blockCount;
@ -178,6 +180,8 @@ void RamCachingFileLoader::SaveIntoCache(s64 pos, size_t bytes, Flags flags) {
if (blocksToRead >= MAX_BLOCKS_PER_READ) { if (blocksToRead >= MAX_BLOCKS_PER_READ) {
break; break;
} }
// TODO: Shouldn't we break as soon as we see a 1?
} }
} }
} }

View file

@ -425,6 +425,7 @@ bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string) {
IdentifiedFileType type = Identify_File(loadedFile, &g_CoreParameter.errorString); IdentifiedFileType type = Identify_File(loadedFile, &g_CoreParameter.errorString);
g_CoreParameter.fileType = type; g_CoreParameter.fileType = type;
if (System_GetPropertyBool(SYSPROP_ENOUGH_RAM_FOR_FULL_ISO)) {
if (g_Config.bCacheFullIsoInRam) { if (g_Config.bCacheFullIsoInRam) {
switch (g_CoreParameter.fileType) { switch (g_CoreParameter.fileType) {
case IdentifiedFileType::PSP_ISO: case IdentifiedFileType::PSP_ISO:
@ -436,6 +437,7 @@ bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string) {
break; break;
} }
} }
}
if (g_Config.bAchievementsEnable) { if (g_Config.bAchievementsEnable) {
// Need to re-identify after ResolveFileLoaderTarget - although in practice probably not, // Need to re-identify after ResolveFileLoaderTarget - although in practice probably not,

View file

@ -625,7 +625,13 @@ bool System_GetPropertyBool(SystemProperty prop) {
#endif #endif
case SYSPROP_CAN_READ_BATTERY_PERCENTAGE: case SYSPROP_CAN_READ_BATTERY_PERCENTAGE:
return true; return true;
default: case SYSPROP_ENOUGH_RAM_FOR_FULL_ISO:
#if defined(MOBILE_DEVICE)
return false;
#else
return true;
#endif
default:
return false; return false;
} }
} }

View file

@ -1341,7 +1341,10 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) {
if (System_GetPropertyBool(SYSPROP_HAS_KEYBOARD)) if (System_GetPropertyBool(SYSPROP_HAS_KEYBOARD))
systemSettings->Add(new CheckBox(&g_Config.bBypassOSKWithKeyboard, sy->T("Use system native keyboard"))); systemSettings->Add(new CheckBox(&g_Config.bBypassOSKWithKeyboard, sy->T("Use system native keyboard")));
if (System_GetPropertyBool(SYSPROP_ENOUGH_RAM_FOR_FULL_ISO)) {
systemSettings->Add(new CheckBox(&g_Config.bCacheFullIsoInRam, sy->T("Cache ISO in RAM", "Cache full ISO in RAM")))->SetEnabled(!PSP_IsInited()); systemSettings->Add(new CheckBox(&g_Config.bCacheFullIsoInRam, sy->T("Cache ISO in RAM", "Cache full ISO in RAM")))->SetEnabled(!PSP_IsInited());
}
systemSettings->Add(new CheckBox(&g_Config.bCheckForNewVersion, sy->T("VersionCheck", "Check for new versions of PPSSPP"))); systemSettings->Add(new CheckBox(&g_Config.bCheckForNewVersion, sy->T("VersionCheck", "Check for new versions of PPSSPP")));
systemSettings->Add(new CheckBox(&g_Config.bScreenshotsAsPNG, sy->T("Screenshots as PNG"))); systemSettings->Add(new CheckBox(&g_Config.bScreenshotsAsPNG, sy->T("Screenshots as PNG")));
static const char *screenshotModeChoices[] = { "Final processed image", "Raw game image" }; static const char *screenshotModeChoices[] = { "Final processed image", "Raw game image" };

View file

@ -406,6 +406,8 @@ bool System_GetPropertyBool(SystemProperty prop) {
return true; return true;
case SYSPROP_CAN_READ_BATTERY_PERCENTAGE: case SYSPROP_CAN_READ_BATTERY_PERCENTAGE:
return true; return true;
case SYSPROP_ENOUGH_RAM_FOR_FULL_ISO:
return true;
default: default:
return false; return false;
} }