Netplay: Still figuring out games tend to desync after the first boot of a game.

This commit is contained in:
HeatXD 2023-05-03 23:40:55 +02:00
parent a1990cf444
commit 438fd768a9
No known key found for this signature in database
GPG Key ID: BF30D71B2F1305C7
2 changed files with 19 additions and 2 deletions

View File

@ -182,6 +182,8 @@ void Netplay::SetSettings()
// no block linking, it degrades savestate loading performance
si.SetBoolValue("CPU", "RecompilerBlockLinking", false);
// not sure its needed but enabled for now. TODO
si.SetBoolValue("GPU", "UseSoftwareRendererForReadbacks", true);
Host::Internal::SetNetplaySettingsLayer(&si);
}
@ -427,14 +429,17 @@ bool Netplay::NpBeginGameCb(void* ctx, const char* game_name)
System::ShutdownSystem(false);
// fast boot the selected game and wait for the other player
auto param = SystemBootParameters(s_game_path);
// param.save_state = EmuFolders::SaveStates + "/SLUS-00402_2.sav";
param.override_fast_boot = true;
if (!System::BootSystem(param))
{
StopNetplaySession();
return false;
}
// Fast Forward to Game Start
SPU::SetAudioOutputMuted(true);
// Load savestate if available
std::string save = EmuFolders::SaveStates + "/netplay/" + System::GetRunningSerial() + ".sav";
System::LoadState(save.c_str());
// Fast Forward to Game Start if needed.
while (System::GetInternalFrameNumber() < 2)
System::RunFrame();
SPU::SetAudioOutputMuted(false);

View File

@ -1752,6 +1752,18 @@ bool System::DoState(StateWrapper& sw, GPUTexture** host_texture, bool update_di
cpu_overclock_active ?
Settings::CPUOverclockFractionToPercent(cpu_overclock_numerator, cpu_overclock_denominator) :
100u);
// during netplay if a file savestate is loaded set
// the overclocks to the same value as the savestate
// file savestates are usually only loaded at game start
if (Netplay::IsActive() && !is_memory_state)
{
g_settings.cpu_overclock_enable = true;
g_settings.cpu_overclock_active = cpu_overclock_active;
g_settings.cpu_overclock_numerator = cpu_overclock_numerator;
g_settings.cpu_overclock_denominator = cpu_overclock_denominator;
}
UpdateOverclock();
}