diff options
Diffstat (limited to 'src/extras/debugmenu.cpp')
-rw-r--r-- | src/extras/debugmenu.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/extras/debugmenu.cpp b/src/extras/debugmenu.cpp index 1c5e26ee..a31426bb 100644 --- a/src/extras/debugmenu.cpp +++ b/src/extras/debugmenu.cpp @@ -1,4 +1,5 @@ #include "common.h" +#ifdef DEBUGMENU #include "RwHelper.h" #include "Pad.h" #include "ControllerConfig.h" @@ -6,6 +7,7 @@ #include "rtcharse.h" #include "inttypes.h" #include "debugmenu.h" +#include <new> #define snprintf _snprintf @@ -152,6 +154,7 @@ struct Menu void update(void); void draw(void); Menu(void){ memset(this, 0, sizeof(Menu)); } + ~Menu(void); }; extern Menu toplevel; @@ -160,6 +163,7 @@ struct MenuEntry_Sub : MenuEntry Menu *submenu; MenuEntry_Sub(const char *name, Menu *menu); + ~MenuEntry_Sub(void) { delete submenu; } }; struct MenuEntry_Var : MenuEntry @@ -705,6 +709,16 @@ Menu::draw(void) ((MenuEntry_Sub*)this->selectedEntry)->submenu->draw(); } +Menu::~Menu(void) +{ + MenuEntry *e, *next; + for(e = entries; e; e = next){ + next = e->next; + delete e; + } + memset(this, 0, sizeof(Menu)); +} + Menu* findMenu(const char *name) { @@ -792,6 +806,7 @@ DebugMenuInit(void) assert(arrow); RwImageDestroy(img); + menuInitialized = true; } @@ -804,7 +819,14 @@ DebugMenuShutdown(void) cursor = nil; RwRasterDestroy(arrow); arrow = nil; - // TODO: the menus ... + + toplevel.~Menu(); + new (&toplevel) Menu(); + + activeMenu = &toplevel; + deepestMenu = &toplevel; + mouseOverMenu = nil; + mouseOverEntry = nil; } menuInitialized = false; } @@ -1292,3 +1314,4 @@ DebugMenuEntrySetAddress(MenuEntry *e, void *addr) ((MenuEntry_Float32*)e)->variable = (float*)addr; } } +#endif
\ No newline at end of file |