EmptyChaos 31cf8432bf HLE: Differentiate Address hooks from Symbol hooks
GeckoCodes require address hooks which don't correspond to any
symbol in the symbol table. The hooks get deleted when repatching
the game because they did not persist across calls to
HLE::PatchFunctions.
2016-10-03 16:27:42 +11:00

41 lines
1023 B
C++

// Copyright 2008 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <string>
#include "Common/CommonTypes.h"
namespace HLE
{
enum HookType
{
HLE_HOOK_START = 0, // Hook the beginning of the function and execute the function afterwards
HLE_HOOK_REPLACE = 1, // Replace the function with the HLE version
HLE_HOOK_NONE = 2, // Do not hook the function
};
enum HookFlag
{
HLE_TYPE_GENERIC = 0, // Miscellaneous function
HLE_TYPE_DEBUG = 1, // Debug output function
HLE_TYPE_FIXED = 2, // An arbitrary hook mapped to a fixed address instead of a symbol
};
void PatchFunctions();
void Clear();
void Patch(u32 pc, const char* func_name);
u32 UnPatch(const std::string& patchName);
bool UnPatch(u32 addr, const std::string& name = {});
void Execute(u32 _CurrentPC, u32 _Instruction);
u32 GetFunctionIndex(u32 em_address);
int GetFunctionTypeByIndex(u32 index);
int GetFunctionFlagsByIndex(u32 index);
bool IsEnabled(int flags);
}