mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-05-03 02:34:48 +12:00
Store program ID and expose it in Lua (#414)
This commit is contained in:
parent
7b580ac80e
commit
6279ed699a
8 changed files with 66 additions and 22 deletions
include
|
@ -132,6 +132,7 @@ class Emulator {
|
|||
ServiceManager& getServiceManager() { return kernel.getServiceManager(); }
|
||||
LuaManager& getLua() { return lua; }
|
||||
Scheduler& getScheduler() { return scheduler; }
|
||||
Memory& getMemory() { return memory; }
|
||||
|
||||
RendererType getRendererType() const { return config.rendererType; }
|
||||
Renderer* getRenderer() { return gpu.getRenderer(); }
|
||||
|
|
|
@ -36,6 +36,7 @@ struct NCCH {
|
|||
};
|
||||
|
||||
u64 partitionIndex = 0;
|
||||
u64 programID = 0;
|
||||
u64 fileOffset = 0;
|
||||
|
||||
bool isNew3DS = false;
|
||||
|
|
|
@ -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() {}
|
||||
|
|
|
@ -275,6 +275,8 @@ private:
|
|||
// File handle for reading the loaded ncch
|
||||
IOFile CXIFile;
|
||||
|
||||
std::optional<u64> getProgramID();
|
||||
|
||||
u8* getDSPMem() { return dspRam; }
|
||||
u8* getDSPDataMem() { return &dspRam[DSP_DATA_MEMORY_OFFSET]; }
|
||||
u8* getDSPCodeMem() { return &dspRam[DSP_CODE_MEMORY_OFFSET]; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue