CDVD: Force initialized flag on NVRAM reads

Jak 1 crashes on boot if it's not set.
This commit is contained in:
Stenzek 2024-06-09 17:57:50 +10:00 committed by Connor McLaughlin
parent b55ec3ae58
commit e2a4d8f1e6
3 changed files with 20 additions and 1 deletions

View File

@ -333,7 +333,18 @@ s32 cdvdReadConfig(u8* config)
cdvdReadNVM(config, nvmLayout->config2 + ((cdvd.CBlockIndex++) * 16), 16);
break;
default:
cdvdReadNVM(config, nvmLayout->config1 + ((cdvd.CBlockIndex++) * 16), 16);
{
cdvdReadNVM(config, nvmLayout->config1 + (cdvd.CBlockIndex * 16), 16);
DEV_LOG("CONF1: {:02X} {:02X} {:02X} {:02X} {:02X} {:02X}", config[0], config[1], config[2], config[3], config[4], config[5]);
if (cdvd.CBlockIndex == 1 && (NoOSD || VMManager::Internal::WasFastBooted()))
{
// HACK: Set the "initialized" flag when fast booting, otherwise some games crash (e.g. Jak 1).
config[2] |= 0x80;
}
cdvd.CBlockIndex++;
}
break;
}
return 0;
}

View File

@ -2626,6 +2626,11 @@ bool VMManager::ShouldAllowPresentThrottle()
return (!valid_vm || (!s_target_speed_synced_to_host && s_target_speed != 1.0f));
}
bool VMManager::Internal::WasFastBooted()
{
return s_fast_boot_requested;
}
bool VMManager::Internal::IsFastBootInProgress()
{
return s_fast_boot_requested && !HasBootedELF();

View File

@ -261,6 +261,9 @@ namespace VMManager
/// Updates the variables in the EmuFolders namespace, reloading subsystems if needed.
void UpdateEmuFolders();
/// Returns true if the VM was fast booted.
bool WasFastBooted();
/// Returns true if fast booting is active (requested but ELF not started).
bool IsFastBootInProgress();