mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 06:05:40 +12:00
* Initial Qt setup * Fix copy paste derp * Remove QApplication include * Test MacOS Qt build * Update Qt_Build.yml * Update Qt_Build.yml * Properly detect architecture for Qt * Revert back to manual Qt installation to handle DLL nightmares * Install Qt for MacOS CI * AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA * Rename lua.hpp to lua_manager.hpp * Add Windows Qt deploy step * Update Qt_Build.yml * Update Qt_Build.yml * Update Qt_Build.yml * Update Qt_Build.yml * AAAAAAAAAAAAAAAAAAAAAA * Update Qt_Build.yml * AAAAAAAAAAAAAA * Update Qt_Build.yml * Update Qt_Build.yml * Update Qt_Build.yml * Create mac-bundle-qt.sh * Update Qt_Build.yml * Update Qt_Build.yml * Update mac-bundle-qt.sh * Update Qt_Build.yml * Update mac-bundle-qt.sh * Update mac-bundle-qt.sh * Update mac-bundle-qt.sh * Update mac-bundle-qt.sh * Recovering from heartbreak after the dylibbundler fork made me sad * Help * Update Qt_Build.yml * Add mac dynlib manager from MelonDS * Update mac-bundle-qt.sh * Update mac-bundle-qt.sh * Update mac-libs.rb * Update mac-bundle-qt.sh * Create linux-appimage-qt.sh * Update Qt_Build.yml
58 lines
No EOL
1.1 KiB
C++
58 lines
No EOL
1.1 KiB
C++
#pragma once
|
|
#include "helpers.hpp"
|
|
#include "memory.hpp"
|
|
|
|
// The kinds of events that can cause a Lua call.
|
|
// Frame: Call program on frame end
|
|
// TODO: Add more
|
|
enum class LuaEvent {
|
|
Frame,
|
|
};
|
|
|
|
#ifdef PANDA3DS_ENABLE_LUA
|
|
extern "C" {
|
|
#include <lauxlib.h>
|
|
#include <lua.h>
|
|
#include <lualib.h>
|
|
|
|
#include "luajit.h"
|
|
}
|
|
|
|
class LuaManager {
|
|
lua_State* L = nullptr;
|
|
bool initialized = false;
|
|
bool haveScript = false;
|
|
|
|
void signalEventInternal(LuaEvent e);
|
|
|
|
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();
|
|
void signalEvent(LuaEvent e) {
|
|
if (haveScript) [[unlikely]] {
|
|
signalEventInternal(e);
|
|
}
|
|
}
|
|
};
|
|
|
|
#elif // Lua not enabled, Lua manager does nothing
|
|
class LuaManager {
|
|
public:
|
|
LuaManager(Memory& mem) {}
|
|
|
|
void close() {}
|
|
void initialize() {}
|
|
void loadFile(const char* path) {}
|
|
void reset() {}
|
|
void signalEvent(LuaEvent e) {}
|
|
};
|
|
#endif |