Hook memory RW to Lua

This commit is contained in:
wheremyfoodat 2023-09-17 19:23:52 +03:00
parent b908f3efc1
commit 74026d2faa
3 changed files with 52 additions and 3 deletions

View file

@ -1,5 +1,6 @@
#pragma once
#include "helpers.hpp"
#include "memory.hpp"
#ifdef PANDA3DS_ENABLE_LUA
extern "C" {
@ -15,8 +16,15 @@ class LuaManager {
bool initialized = false;
public:
// For Lua we must have some global pointers to our emulator objects to use them in script code via thunks. See the thunks in lua.cpp as an
// example
static Memory* g_memory;
LuaManager(Memory& mem) { g_memory = &mem; }
void close();
void initialize();
void initializeThunks();
void loadFile(const char* path);
void reset();
};
@ -24,6 +32,8 @@ class LuaManager {
#elif // Lua not enabled, Lua manager does nothing
class LuaManager {
public:
LuaManager(Memory& mem) {}
void close() {}
void initialize() {}
void loadFile(const char* path) {}