HLE: Move static variable out of header

It's only ever used in the implementation file.
This commit is contained in:
Lioncash 2016-01-11 04:02:50 -05:00
parent ff0e1c3624
commit 846c904624
2 changed files with 8 additions and 9 deletions

View File

@ -23,6 +23,8 @@ using namespace PowerPC;
typedef void (*TPatchFunction)(); typedef void (*TPatchFunction)();
static std::map<u32, u32> s_original_instructions;
enum enum
{ {
HLE_RETURNTYPE_BLR = 0, HLE_RETURNTYPE_BLR = 0,
@ -72,7 +74,7 @@ void Patch(u32 addr, const char *hle_func_name)
{ {
if (!strcmp(OSPatches[i].m_szPatchName, hle_func_name)) if (!strcmp(OSPatches[i].m_szPatchName, hle_func_name))
{ {
orig_instruction[addr] = i; s_original_instructions[addr] = i;
return; return;
} }
} }
@ -80,7 +82,7 @@ void Patch(u32 addr, const char *hle_func_name)
void PatchFunctions() void PatchFunctions()
{ {
orig_instruction.clear(); s_original_instructions.clear();
for (u32 i = 0; i < sizeof(OSPatches) / sizeof(SPatch); i++) for (u32 i = 0; i < sizeof(OSPatches) / sizeof(SPatch); i++)
{ {
Symbol *symbol = g_symbolDB.GetSymbolFromName(OSPatches[i].m_szPatchName); Symbol *symbol = g_symbolDB.GetSymbolFromName(OSPatches[i].m_szPatchName);
@ -88,7 +90,7 @@ void PatchFunctions()
{ {
for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4) for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4)
{ {
orig_instruction[addr] = i; s_original_instructions[addr] = i;
} }
INFO_LOG(OSHLE, "Patching %s %08x", OSPatches[i].m_szPatchName, symbol->address); INFO_LOG(OSHLE, "Patching %s %08x", OSPatches[i].m_szPatchName, symbol->address);
} }
@ -127,8 +129,8 @@ void Execute(u32 _CurrentPC, u32 _Instruction)
u32 GetFunctionIndex(u32 addr) u32 GetFunctionIndex(u32 addr)
{ {
std::map<u32, u32>::const_iterator iter = orig_instruction.find(addr); auto iter = s_original_instructions.find(addr);
return (iter != orig_instruction.end()) ? iter->second : 0; return (iter != s_original_instructions.end()) ? iter->second : 0;
} }
int GetFunctionTypeByIndex(u32 index) int GetFunctionTypeByIndex(u32 index)
@ -157,7 +159,7 @@ u32 UnPatch(const std::string& patchName)
{ {
for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4) for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4)
{ {
orig_instruction[addr] = 0; s_original_instructions[addr] = 0;
PowerPC::ppcState.iCache.Invalidate(addr); PowerPC::ppcState.iCache.Invalidate(addr);
} }
return symbol->address; return symbol->address;

View File

@ -4,7 +4,6 @@
#pragma once #pragma once
#include <map>
#include <string> #include <string>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
@ -35,6 +34,4 @@ namespace HLE
int GetFunctionFlagsByIndex(u32 index); int GetFunctionFlagsByIndex(u32 index);
bool IsEnabled(int flags); bool IsEnabled(int flags);
static std::map<u32, u32> orig_instruction;
} }