diff --git a/src/debugmenu_public.h b/src/debugmenu_public.h index 42fd986..5bc72bd 100644 --- a/src/debugmenu_public.h +++ b/src/debugmenu_public.h @@ -22,6 +22,7 @@ typedef void (*DebugMenuEntrySetAddress_TYPE)(DebugMenuEntry *e, void *addr); struct DebugMenuAPI { + bool isLoaded; DebugMenuAddInt8_TYPE addint8; DebugMenuAddInt16_TYPE addint16; DebugMenuAddInt32_TYPE addint32; @@ -70,6 +71,8 @@ inline void DebugMenuEntrySetAddress(DebugMenuEntry *e, void *addr) inline bool DebugMenuLoad(void) { + if(gDebugMenuAPI.isLoaded) + return true; HMODULE mod = LoadLibrary("debugmenu.dll"); if(mod == 0){ char modulePath[MAX_PATH]; @@ -97,6 +100,7 @@ inline bool DebugMenuLoad(void) gDebugMenuAPI.setwrap = (DebugMenuEntrySetWrap_TYPE)GetProcAddress(mod, "DebugMenuEntrySetWrap"); gDebugMenuAPI.setstrings = (DebugMenuEntrySetStrings_TYPE)GetProcAddress(mod, "DebugMenuEntrySetStrings"); gDebugMenuAPI.setaddress = (DebugMenuEntrySetAddress_TYPE)GetProcAddress(mod, "DebugMenuEntrySetAddress"); + gDebugMenuAPI.isLoaded = true; return true; }