Show last lua mod to run in crash handler

This commit is contained in:
MysterD 2022-03-09 18:23:42 -08:00
parent 8802642296
commit 9388aa8885
4 changed files with 7 additions and 0 deletions

View File

@ -463,6 +463,7 @@ static CRASH_HANDLER_TYPE crash_handler(EXCEPTION_POINTERS *ExceptionInfo) {
for (int i = 0; i < gModTableCurrent->entryCount; i++) {
struct ModListEntry* entry = &gModTableCurrent->entries[i];
if (entry == NULL || !entry->enabled) { continue; }
u8 b = (gPcDebug.lastModRun == entry) ? 0 : 0xFF;
crash_handler_set_text(x, y, 0xFF, 0xFF, 200, "%.21s", entry->name);
y += 8;
}
@ -546,6 +547,7 @@ struct PcDebug gPcDebug = {
.id = DEFAULT_ID,
.bhvOffset = /* 0x12 */ 0,
.debugId = 0x4BE2,
.lastModRun = NULL,
};
void crash_handler_init(void) {

View File

@ -11,6 +11,7 @@ struct PcDebug {
u64 id;
u64 bhvOffset;
u64 debugId;
void* lastModRun;
};
extern struct PcDebug gPcDebug;

View File

@ -1,5 +1,6 @@
#include "smlua.h"
#include "pc/mod_list.h"
#include "pc/crash_handler.h"
lua_State* gLuaState = NULL;
u8 gLuaInitializingScript = 0;
@ -102,6 +103,7 @@ void smlua_init(void) {
LOG_INFO(" %s", entry->path);
gLuaLoadingEntry = entry;
gLuaActiveEntry = entry;
gPcDebug.lastModRun = gLuaActiveEntry;
smlua_load_script(entry->path, entry->remoteIndex);
gLuaActiveEntry = NULL;
gLuaLoadingEntry = NULL;

View File

@ -1,4 +1,5 @@
#include "smlua.h"
#include "pc/crash_handler.h"
#include "pc/mod_list.h"
#include "pc/network/network.h"
@ -152,6 +153,7 @@ static void smlua_sync_table_call_hook(int syncTableIndex, int keyIndex, int pre
// call hook
struct ModListEntry* prev = gLuaActiveEntry;
gLuaActiveEntry = setEntry;
gPcDebug.lastModRun = gLuaActiveEntry;
if (0 != lua_pcall(L, 3, 0, 0)) {
LOG_LUA("Failed to call the hook_on_changed callback: %s", lua_tostring(L, -1));
smlua_logline();