summaryrefslogtreecommitdiffstats
path: root/src/extras
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-04-25 00:40:14 +0200
committeraap <aap@papnet.eu>2020-04-25 00:41:17 +0200
commitac19de45b88123b2284ecc3ab44cedcaa7ca496d (patch)
tree5e512242f7c7f41fcb9c685c2679c6b004bae8fd /src/extras
parentimplemented debugmenu (diff)
downloadre3-ac19de45b88123b2284ecc3ab44cedcaa7ca496d.tar
re3-ac19de45b88123b2284ecc3ab44cedcaa7ca496d.tar.gz
re3-ac19de45b88123b2284ecc3ab44cedcaa7ca496d.tar.bz2
re3-ac19de45b88123b2284ecc3ab44cedcaa7ca496d.tar.lz
re3-ac19de45b88123b2284ecc3ab44cedcaa7ca496d.tar.xz
re3-ac19de45b88123b2284ecc3ab44cedcaa7ca496d.tar.zst
re3-ac19de45b88123b2284ecc3ab44cedcaa7ca496d.zip
Diffstat (limited to 'src/extras')
-rw-r--r--src/extras/debugmenu.cpp36
-rw-r--r--src/extras/debugmenu.h2
2 files changed, 33 insertions, 5 deletions
diff --git a/src/extras/debugmenu.cpp b/src/extras/debugmenu.cpp
index d6ee18ab..f419e76f 100644
--- a/src/extras/debugmenu.cpp
+++ b/src/extras/debugmenu.cpp
@@ -95,6 +95,18 @@ createMenuFont(void)
RtCharsetGetDesc(fontStyles[MENUFONT_NORMAL], &fontDesc);
}
+void
+destroyMenuFont(void)
+{
+ RtCharsetDestroy(fontStyles[MENUFONT_NORMAL]);
+ fontStyles[MENUFONT_NORMAL] = nil;
+ RtCharsetDestroy(fontStyles[MENUFONT_SEL_ACTIVE]);
+ fontStyles[MENUFONT_SEL_ACTIVE] = nil;
+ RtCharsetDestroy(fontStyles[MENUFONT_SEL_INACTIVE]);
+ fontStyles[MENUFONT_SEL_INACTIVE] = nil;
+ RtCharsetDestroy(fontStyles[MENUFONT_MOUSE]);
+ fontStyles[MENUFONT_MOUSE] = nil;
+}
@@ -755,7 +767,7 @@ static uint8 arrowPx[] = {
};
void
-initDebug(void)
+DebugMenuInit(void)
{
createMenuFont();
@@ -779,6 +791,22 @@ initDebug(void)
arrow = RwRasterSetFromImage(arrow, img);
assert(arrow);
RwImageDestroy(img);
+
+ menuInitialized = true;
+}
+
+void
+DebugMenuShutdown(void)
+{
+ if(menuInitialized){
+ destroyMenuFont();
+ RwRasterDestroy(cursor);
+ cursor = nil;
+ RwRasterDestroy(arrow);
+ arrow = nil;
+ // TODO: the menus ...
+ }
+ menuInitialized = false;
}
void
@@ -971,10 +999,8 @@ DebugMenuProcess(void)
pad->DisablePlayerControls = 1;
// TODO: this could happen earlier
- if(!menuInitialized){
- initDebug();
- menuInitialized = 1;
- }
+ if(!menuInitialized)
+ DebugMenuInit();
updateMouse();
}
diff --git a/src/extras/debugmenu.h b/src/extras/debugmenu.h
index 29bbd972..3ef8c742 100644
--- a/src/extras/debugmenu.h
+++ b/src/extras/debugmenu.h
@@ -31,6 +31,8 @@ MenuEntry *DebugMenuAddCmd(const char *path, const char *name, TriggerFunc trigg
void DebugMenuEntrySetWrap(MenuEntry *e, bool wrap);
void DebugMenuEntrySetStrings(MenuEntry *e, const char **strings);
void DebugMenuEntrySetAddress(MenuEntry *e, void *addr);
+void DebugMenuInit(void);
+void DebugMenuShutdown(void);
void DebugMenuProcess(void);
void DebugMenuRender(void);