Core: Maintain frame dump disc ID in SFO.

This way we won't generate a fake one later and use it for anything else.
This commit is contained in:
Unknown W. Brackets 2021-01-31 09:22:20 -08:00
parent a20c972d55
commit 2a545a317c

View file

@ -245,51 +245,48 @@ bool CPU_Init() {
MIPSAnalyst::Reset(); MIPSAnalyst::Reset();
Replacement_Init(); Replacement_Init();
std::string discID; bool allowPlugins = true;
std::string geDumpDiscID;
switch (type) { switch (type) {
case IdentifiedFileType::PSP_ISO: case IdentifiedFileType::PSP_ISO:
case IdentifiedFileType::PSP_ISO_NP: case IdentifiedFileType::PSP_ISO_NP:
case IdentifiedFileType::PSP_DISC_DIRECTORY: case IdentifiedFileType::PSP_DISC_DIRECTORY:
InitMemoryForGameISO(loadedFile); InitMemoryForGameISO(loadedFile);
discID = g_paramSFO.GetDiscID();
break; break;
case IdentifiedFileType::PSP_PBP: case IdentifiedFileType::PSP_PBP:
case IdentifiedFileType::PSP_PBP_DIRECTORY: case IdentifiedFileType::PSP_PBP_DIRECTORY:
// This is normal for homebrew. // This is normal for homebrew.
// ERROR_LOG(LOADER, "PBP directory resolution failed."); // ERROR_LOG(LOADER, "PBP directory resolution failed.");
InitMemoryForGamePBP(loadedFile); InitMemoryForGamePBP(loadedFile);
discID = g_paramSFO.GetDiscID();
break; break;
case IdentifiedFileType::PSP_ELF: case IdentifiedFileType::PSP_ELF:
if (Memory::g_PSPModel != PSP_MODEL_FAT) { if (Memory::g_PSPModel != PSP_MODEL_FAT) {
INFO_LOG(LOADER, "ELF, using full PSP-2000 memory access"); INFO_LOG(LOADER, "ELF, using full PSP-2000 memory access");
Memory::g_MemorySize = Memory::RAM_DOUBLE_SIZE; Memory::g_MemorySize = Memory::RAM_DOUBLE_SIZE;
} }
discID = g_paramSFO.GetDiscID();
break; break;
case IdentifiedFileType::PPSSPP_GE_DUMP: case IdentifiedFileType::PPSSPP_GE_DUMP:
// Try to grab the disc ID from the filename, since unfortunately, we don't store // Try to grab the disc ID from the filenameor GE dump.
// it in the GE dump. This should probably be fixed, but as long as you don't rename the dumps, if (DiscIDFromGEDumpPath(filename, loadedFile, &geDumpDiscID)) {
// this will do the trick. // Store in SFO, otherwise it'll generate a fake disc ID.
if (!DiscIDFromGEDumpPath(filename, loadedFile, &discID)) { g_paramSFO.SetValue("DISC_ID", geDumpDiscID, 16);
// Failed? Let the param SFO autogen a fake disc ID.
discID = g_paramSFO.GetDiscID();
} }
allowPlugins = false;
break; break;
default: default:
discID = g_paramSFO.GetDiscID();
break; break;
} }
// Here we have read the PARAM.SFO, let's see if we need any compatibility overrides. // Here we have read the PARAM.SFO, let's see if we need any compatibility overrides.
// Homebrew usually has an empty discID, and even if they do have a disc id, it's not // Homebrew usually has an empty discID, and even if they do have a disc id, it's not
// likely to collide with any commercial ones. // likely to collide with any commercial ones.
coreParameter.compat.Load(discID); coreParameter.compat.Load(g_paramSFO.GetDiscID());
InitVFPUSinCos(coreParameter.compat.flags().DoublePrecisionSinCos); InitVFPUSinCos(coreParameter.compat.flags().DoublePrecisionSinCos);
HLEPlugins::Init(); if (allowPlugins)
HLEPlugins::Init();
if (!Memory::Init()) { if (!Memory::Init()) {
// We're screwed. // We're screwed.
return false; return false;