summaryrefslogtreecommitdiffstats
path: root/src/extras/debugmenu.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-05-01 20:23:09 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-05-01 20:23:09 +0200
commit026ed72bfc6ce52cf614d739b9f40c8092c47036 (patch)
treee6ec1df25a3cde60b43ca17f60d328e79177c399 /src/extras/debugmenu.cpp
parentMerge remote-tracking branch 'upstream/master' (diff)
parentMerge pull request #501 from erorcun/erorcun (diff)
downloadre3-026ed72bfc6ce52cf614d739b9f40c8092c47036.tar
re3-026ed72bfc6ce52cf614d739b9f40c8092c47036.tar.gz
re3-026ed72bfc6ce52cf614d739b9f40c8092c47036.tar.bz2
re3-026ed72bfc6ce52cf614d739b9f40c8092c47036.tar.lz
re3-026ed72bfc6ce52cf614d739b9f40c8092c47036.tar.xz
re3-026ed72bfc6ce52cf614d739b9f40c8092c47036.tar.zst
re3-026ed72bfc6ce52cf614d739b9f40c8092c47036.zip
Diffstat (limited to 'src/extras/debugmenu.cpp')
-rw-r--r--src/extras/debugmenu.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/extras/debugmenu.cpp b/src/extras/debugmenu.cpp
index 1c5e26ee..bb0ed55e 100644
--- a/src/extras/debugmenu.cpp
+++ b/src/extras/debugmenu.cpp
@@ -6,6 +6,7 @@
#include "rtcharse.h"
#include "inttypes.h"
#include "debugmenu.h"
+#include <new>
#define snprintf _snprintf
@@ -152,6 +153,7 @@ struct Menu
void update(void);
void draw(void);
Menu(void){ memset(this, 0, sizeof(Menu)); }
+ ~Menu(void);
};
extern Menu toplevel;
@@ -160,6 +162,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 +708,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 +805,7 @@ DebugMenuInit(void)
assert(arrow);
RwImageDestroy(img);
+
menuInitialized = true;
}
@@ -804,7 +818,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;
}