Skip to content

Commit

Permalink
VMManager / vuJIT: Fix save state loading and saving on ARM64
Browse files Browse the repository at this point in the history
  • Loading branch information
F0bes committed Jan 17, 2025
1 parent fbe0c8b commit 4a57bd7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
10 changes: 10 additions & 0 deletions pcsx2/VMManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2561,6 +2561,11 @@ void VMManager::InitializeCPUProviders()

CpuMicroVU0.Reserve();
CpuMicroVU1.Reserve();
#else
// Despite not having any VU recompilers on ARM64, therefore no MTVU,
// we still need the thread alive. Otherwise the read and write positions
// of the ring buffer wont match, and various systems in the emulator end up deadlocked.
vu1Thread.Open();
#endif

VifUnpackSSE_Init();
Expand All @@ -2580,6 +2585,11 @@ void VMManager::ShutdownCPUProviders()

psxRec.Shutdown();
recCpu.Shutdown();
#else
// See the comment in the InitializeCPUProviders for an explaination why we
// still need to manage the MTVU thread.
if(vu1Thread.IsOpen())
vu1Thread.WaitVU();
#endif
}

Expand Down
16 changes: 14 additions & 2 deletions pcsx2/arm64/RecStubs.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
// SPDX-License-Identifier: GPL-3.0

#include "common/Console.h"
#include "MTVU.h"
#include "SaveState.h"
#include "vtlb.h"

Expand All @@ -13,6 +15,16 @@ void vtlb_DynBackpatchLoadStore(uptr code_address, u32 code_size, u32 guest_pc,

bool SaveStateBase::vuJITFreeze()
{
pxFailRel("Not implemented.");
return false;
if(IsSaving())
vu1Thread.WaitVU();

Console.Warning("recompiler state is stubbed in arm64!");

// HACK!!

// size of microRegInfo structure
std::array<u8,96> empty_data{};
Freeze(empty_data);
Freeze(empty_data);
return true;
}

0 comments on commit 4a57bd7

Please sign in to comment.