Mesen-S/Core/LuaScriptingContext.h
Sour 5f055110fa Added Game Boy support
CPU/APU are decent - PPU is still just a scanline renderer
No Super Game Boy support yet
2020-05-18 16:11:08 -04:00

37 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;
};