Mesen-SX/Core/LuaScriptingContext.h
NovaSquirrel c0e249e993 Revert "Merge branch 'reformat_code'"
This reverts commit daf3b57e89, reversing
changes made to 7a6e0b7d77.
2021-03-10 11:13:28 -05:00

36 lines
1 KiB
C++

#pragma once
#include "stdafx.h"
#include "DebugTypes.h"
#include "ScriptingContext.h"
#include "EventType.h"
#include "../Utilities/Timer.h"
struct lua_State;
struct lua_Debug;
class Debugger;
class LuaScriptingContext : public ScriptingContext
{
private:
static LuaScriptingContext* _context;
static uint32_t _timeout;
lua_State* _lua = nullptr;
Timer _timer;
static void ExecutionCountHook(lua_State* lua, lua_Debug* ar);
protected:
void InternalCallMemoryCallback(uint32_t addr, uint8_t &value, CallbackType type, CpuType cpuType) override;
int InternalCallEventCallback(EventType type) override;
public:
LuaScriptingContext(Debugger* debugger);
virtual ~LuaScriptingContext();
static void SetScriptTimeout(uint32_t timeout);
bool LoadScript(string scriptName, string scriptContent, Debugger* debugger) override;
void UnregisterMemoryCallback(CallbackType type, int startAddr, int endAddr, CpuType cpuType, int reference) override;
void UnregisterEventCallback(EventType type, int reference) override;
};