Simulates memory stick size to get fixed free space.
Some games may be sensitive to the changes of free space of memory stick, and Android's free space is usually variable.
This commit is contained in:
parent
f0ea814107
commit
166035a87b
6 changed files with 28 additions and 6 deletions
|
@ -1030,6 +1030,7 @@ static ConfigSetting systemParamSettings[] = {
|
|||
ConfigSetting("WlanPowerSave", &g_Config.bWlanPowerSave, (bool) PSP_SYSTEMPARAM_WLAN_POWERSAVE_OFF, true, true),
|
||||
ReportedConfigSetting("EncryptSave", &g_Config.bEncryptSave, true, true, true),
|
||||
ConfigSetting("SavedataUpgradeVersion", &g_Config.bSavedataUpgrade, true, true, false),
|
||||
ConfigSetting("MemStickSize", &g_Config.iMemStickSizeGB, 16, true, false),
|
||||
|
||||
ConfigSetting(false),
|
||||
};
|
||||
|
|
|
@ -123,6 +123,7 @@ public:
|
|||
std::string sRemoteISOSubdir;
|
||||
bool bRemoteDebuggerOnStartup;
|
||||
bool bMemStickInserted;
|
||||
int iMemStickSizeGB;
|
||||
bool bLoadPlugins;
|
||||
|
||||
int iScreenRotation; // The rotation angle of the PPSSPP UI. Only supported on Android and possibly other mobile platforms.
|
||||
|
|
|
@ -669,3 +669,17 @@ void MetaFileSystem::DoState(PointerWrap &p)
|
|||
}
|
||||
}
|
||||
|
||||
u64 MetaFileSystem::getDirSize(const std::string &dirPath) {
|
||||
u64 result = 0;
|
||||
auto allFiles = GetDirListing(dirPath);
|
||||
for (auto file : allFiles) {
|
||||
if (file.name == "." || file.name == "..")
|
||||
continue;
|
||||
if (file.type == FILETYPE_DIRECTORY) {
|
||||
result += getDirSize(dirPath + file.name + "/");
|
||||
} else {
|
||||
result += file.size;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -129,4 +129,6 @@ public:
|
|||
std::lock_guard<std::recursive_mutex> guard(lock);
|
||||
startingDirectory = dir;
|
||||
}
|
||||
|
||||
u64 getDirSize(const std::string &dirPath);
|
||||
};
|
||||
|
|
|
@ -71,15 +71,18 @@ u64 MemoryStick_SectorSize() {
|
|||
}
|
||||
|
||||
u64 MemoryStick_FreeSpace() {
|
||||
u64 freeSpace = pspFileSystem.FreeSpace("ms0:/");
|
||||
|
||||
// Cap the memory stick size to avoid math errors when old games get sizes that were
|
||||
// hard to imagine back then.
|
||||
// We have a compat setting to make it even smaller for Harry Potter : Goblet of Fire, see #13266.
|
||||
const u64 memStickSize = PSP_CoreParameter().compat.flags().ReportSmallMemstick ? smallMemstickSize : normalMemstickSize;
|
||||
if (freeSpace < memStickSize)
|
||||
const u64 memStickSize = PSP_CoreParameter().compat.flags().ReportSmallMemstick ? smallMemstickSize : (u64)g_Config.iMemStickSizeGB * 1024 * 1024 * 1024;
|
||||
u64 usedSpace = pspFileSystem.getDirSize("ms0:/PSP/SAVEDATA/");// Assume the memory stick is only used to store savedata.
|
||||
u64 freeSpace;
|
||||
if (usedSpace >= memStickSize)
|
||||
freeSpace = 0;
|
||||
else
|
||||
freeSpace = memStickSize - usedSpace;
|
||||
|
||||
return freeSpace;
|
||||
return memStickSize;
|
||||
}
|
||||
|
||||
void MemoryStick_SetFatState(MemStickFatState state) {
|
||||
|
|
|
@ -897,6 +897,7 @@ void GameSettingsScreen::CreateViews() {
|
|||
rewindFreq->SetZeroLabel(sy->T("Off"));
|
||||
|
||||
systemSettings->Add(new CheckBox(&g_Config.bMemStickInserted, sy->T("Memory Stick inserted")));
|
||||
PopupSliderChoice *memStickSize = systemSettings->Add(new PopupSliderChoice(&g_Config.iMemStickSizeGB, 1, 128, sy->T("Change Memory Stick Size", "Change Memory Stick Size(GB)"), screenManager(), "GB"));
|
||||
|
||||
systemSettings->Add(new ItemHeader(sy->T("General")));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue