Merge pull request #3499 from lioncash/hle

HLE: Move static variable out of header
This commit is contained in:
Pierre Bourdon 2016-01-11 12:42:48 +01:00
commit 7c6fe11348
2 changed files with 8 additions and 9 deletions

View File

@ -23,6 +23,8 @@ using namespace PowerPC;
typedef void (*TPatchFunction)();
static std::map<u32, u32> s_original_instructions;
enum
{
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))
{
orig_instruction[addr] = i;
s_original_instructions[addr] = i;
return;
}
}
@ -80,7 +82,7 @@ void Patch(u32 addr, const char *hle_func_name)
void PatchFunctions()
{
orig_instruction.clear();
s_original_instructions.clear();
for (u32 i = 0; i < sizeof(OSPatches) / sizeof(SPatch); i++)
{
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)
{
orig_instruction[addr] = i;
s_original_instructions[addr] = i;
}
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)
{
std::map<u32, u32>::const_iterator iter = orig_instruction.find(addr);
return (iter != orig_instruction.end()) ? iter->second : 0;
auto iter = s_original_instructions.find(addr);
return (iter != s_original_instructions.end()) ? iter->second : 0;
}
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)
{
orig_instruction[addr] = 0;
s_original_instructions[addr] = 0;
PowerPC::ppcState.iCache.Invalidate(addr);
}
return symbol->address;

View File

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