project64/Source/Project64/UserInterface/Debugger/ScriptHook.h

46 lines
1.3 KiB
C
Raw Normal View History

2017-08-18 05:08:22 +00:00
#pragma once
#include <stdafx.h>
class CScriptInstance;
class CScriptSystem;
class CScriptHook
{
private:
2017-09-13 10:18:59 +00:00
typedef struct {
CScriptInstance* scriptInstance;
void* heapptr;
uint32_t param;
uint32_t param2;
2018-11-21 08:57:50 +00:00
uint32_t param3;
uint32_t param4;
2017-09-13 10:18:59 +00:00
int callbackId;
bool bOnce;
} JSCALLBACK;
2017-08-18 05:08:22 +00:00
2017-09-13 10:18:59 +00:00
CScriptSystem* m_ScriptSystem;
2017-08-18 05:08:22 +00:00
2017-09-13 10:18:59 +00:00
//int m_NextCallbackId;
vector<JSCALLBACK> m_Callbacks;
2017-08-18 05:08:22 +00:00
2018-11-21 08:57:50 +00:00
public:
2017-09-13 10:18:59 +00:00
CScriptHook(CScriptSystem* scriptSystem);
~CScriptHook();
2018-11-21 08:57:50 +00:00
int Add(CScriptInstance* scriptInstance, void* heapptr, uint32_t param = 0, uint32_t param2 = 0,
uint32_t param3 = 0, uint32_t param4 = 0, bool bOnce = false);
2017-09-13 10:18:59 +00:00
void InvokeAll();
void InvokeById(int callbackId);
void InvokeByParam(uint32_t param);
/* invoke if param >= cb.param && param < cb.param2*/
void InvokeByAddressInRange(uint32_t address);
2018-11-21 08:57:50 +00:00
/* invoke if param >= cb.param && param < cb.param2 && (value & cb.param4) == cb.param3 */
void InvokeByAddressInRange_MaskedOpcode(uint32_t pc, uint32_t value);
2019-12-25 00:41:20 +00:00
void InvokeByAddressInRange_GPRValue(uint32_t pc);
2017-09-13 10:18:59 +00:00
void RemoveById(int callbackId);
void RemoveByParam(uint32_t tag);
void RemoveByInstance(CScriptInstance* scriptInstance);
bool HasContext(CScriptInstance* scriptInstance);
//bool HasTag(uint32_t tag);
2018-11-21 08:57:50 +00:00
};