summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
m---------librw0
-rw-r--r--src/extras/debugmenu.cpp23
-rw-r--r--src/extras/debugmenu.h1
-rw-r--r--src/fakerw/fake.cpp4
4 files changed, 25 insertions, 3 deletions
diff --git a/librw b/librw
-Subproject d732817759789b5d620bd5ae6ed162f9ff3061f
+Subproject dfedaee353ccbf4dcfcfd3eb4024e0dd8e9b4b6
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;
}
diff --git a/src/extras/debugmenu.h b/src/extras/debugmenu.h
index 462b59c4..ae595c1f 100644
--- a/src/extras/debugmenu.h
+++ b/src/extras/debugmenu.h
@@ -13,6 +13,7 @@ struct MenuEntry
Menu *menu;
MenuEntry(const char *name);
+ virtual ~MenuEntry(void) {}
};
typedef MenuEntry DebugMenuEntry;
diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp
index 113c4519..d2547815 100644
--- a/src/fakerw/fake.cpp
+++ b/src/fakerw/fake.cpp
@@ -392,8 +392,8 @@ RwStream *RwStreamOpen(RwStreamType type, RwStreamAccessType accessType, const v
}
}
RwBool RwStreamClose(RwStream * stream, void *pData) { stream->close(); rwFree(stream); return true; }
-RwUInt32 RwStreamRead(RwStream * stream, void *buffer, RwUInt32 length) { return stream->read(buffer, length); }
-RwStream *RwStreamWrite(RwStream * stream, const void *buffer, RwUInt32 length) { stream->write(buffer, length); return stream; }
+RwUInt32 RwStreamRead(RwStream * stream, void *buffer, RwUInt32 length) { return stream->read8(buffer, length); }
+RwStream *RwStreamWrite(RwStream * stream, const void *buffer, RwUInt32 length) { stream->write8(buffer, length); return stream; }
RwStream *RwStreamSkip(RwStream * stream, RwUInt32 offset) { stream->seek(offset); return stream; }
RwBool RwStreamFindChunk(RwStream *stream, RwUInt32 type, RwUInt32 *lengthOut, RwUInt32 *versionOut)