Skip to content

Commit

Permalink
RiivolutionParser: Remove usages of global system accessor
Browse files Browse the repository at this point in the history
We can retrieve the encompassing system instance through the
CPUThreadGuard instance instead.
  • Loading branch information
lioncash committed Dec 12, 2023
1 parent c2e39e0 commit b728e37
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Source/Core/DiscIO/RiivolutionPatcher.cpp
Expand Up @@ -15,6 +15,7 @@
#include "Common/IOFile.h"
#include "Common/StringUtil.h"
#include "Core/Config/AchievementSettings.h"
#include "Core/Core.h"
#include "Core/HLE/HLE.h"
#include "Core/HW/Memmap.h"
#include "Core/IOS/FS/FileSystem.h"
Expand Down Expand Up @@ -534,7 +535,7 @@ static void ApplyMemoryPatch(const Core::CPUThreadGuard& guard, u32 offset,
if (!original.empty() && !MemoryMatchesAt(guard, offset, original))
return;

auto& system = Core::System::GetInstance();
auto& system = guard.GetSystem();
const u32 size = static_cast<u32>(value.size());
for (u32 i = 0; i < size; ++i)
PowerPC::MMU::HostTryWriteU8(guard, value[i], offset + i);
Expand Down Expand Up @@ -590,7 +591,7 @@ static void ApplyOcarinaMemoryPatch(const Core::CPUThreadGuard& guard, const Pat
if (value.empty())
return;

auto& system = Core::System::GetInstance();
auto& system = guard.GetSystem();
for (u32 i = 0; i < length; i += 4)
{
// first find the pattern
Expand Down Expand Up @@ -624,7 +625,7 @@ static void ApplyOcarinaMemoryPatch(const Core::CPUThreadGuard& guard, const Pat

void ApplyGeneralMemoryPatches(const Core::CPUThreadGuard& guard, std::span<const Patch> patches)
{
const auto& system = Core::System::GetInstance();
const auto& system = guard.GetSystem();
const auto& system_memory = system.GetMemory();

for (const auto& patch : patches)
Expand Down

0 comments on commit b728e37

Please sign in to comment.