Store program ID and expose it in Lua (#414)

This commit is contained in:
wheremyfoodat 2024-02-22 14:26:31 +00:00 committed by GitHub
parent 7b580ac80e
commit 6279ed699a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 66 additions and 22 deletions

View file

@ -2,7 +2,6 @@
#include <string>
#include "helpers.hpp"
#include "memory.hpp"
// The kinds of events that can cause a Lua call.
// Frame: Call program on frame end
@ -11,6 +10,8 @@ enum class LuaEvent {
Frame,
};
class Emulator;
#ifdef PANDA3DS_ENABLE_LUA
extern "C" {
#include <lauxlib.h>
@ -30,9 +31,9 @@ class LuaManager {
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;
static Emulator* g_emulator;
LuaManager(Memory& mem) { g_memory = &mem; }
LuaManager(Emulator& emulator) { g_emulator = &emulator; }
void close();
void initialize();
@ -51,7 +52,7 @@ class LuaManager {
#else // Lua not enabled, Lua manager does nothing
class LuaManager {
public:
LuaManager(Memory& mem) {}
LuaManager(Emulator& emulator) {}
void close() {}
void initialize() {}