diff --git a/configure.py b/configure.py index f9b45987..2d8e0402 100644 --- a/configure.py +++ b/configure.py @@ -795,9 +795,7 @@ config.libs = [ "objects": [ Object(NonMatching, "Famicom/ks_nes_core.cpp"), Object(NonMatching, "Famicom/ks_nes_draw.cpp"), - # TODO: get ~J2DOrthoGraph's dtor in here somehow? 0x800468fc - # also add in JUTGamePad::getPortStatus when JUTGamePad is linked? - Object(NonMatching, "Famicom/famicom.cpp"), + Object(Matching, "Famicom/famicom.cpp"), Object(Matching, "Famicom/famicom_nesinfo.cpp"), ], }, diff --git a/include/Famicom/famicomInternal.hpp b/include/Famicom/famicomInternal.hpp index 97ab6ba7..ed43aa4b 100644 --- a/include/Famicom/famicomInternal.hpp +++ b/include/Famicom/famicomInternal.hpp @@ -7,7 +7,7 @@ #define MURA_GAME_NAME_SIZE 16 -static void* my_malloc(size_t size, u32 align) { return (*my_malloc_current->malloc_align)(size, align); } +static void* my_malloc(size_t size, int align) { return (*my_malloc_current->malloc_align)(size, align); } static void my_free(void* ptr) { (*my_malloc_current->free)(ptr); } static int my_getmemblocksize(void* ptr) { return (*my_malloc_current->getmemblocksize)(ptr); } static int my_gettotalfreesize() { return (*my_malloc_current->gettotalfreesize)(); } diff --git a/include/JSystem/J2D/J2DGrafContext.h b/include/JSystem/J2D/J2DGrafContext.h index c165338b..da97d160 100644 --- a/include/JSystem/J2D/J2DGrafContext.h +++ b/include/JSystem/J2D/J2DGrafContext.h @@ -26,8 +26,7 @@ struct J2DGrafBlend { struct J2DGrafContext { J2DGrafContext(f32, f32, f32, f32); - virtual ~J2DGrafContext() { - } // _08 (weak) + virtual ~J2DGrafContext() {} // _08 (weak) virtual void place(const JGeometry::TBox2f&); // _0C virtual void place(f32 x, f32 y, f32 width, f32 height) { JGeometry::TBox2f box(x, y, x + width, y + height); diff --git a/include/JSystem/JUtility/JUTGamePad.h b/include/JSystem/JUtility/JUTGamePad.h index 2385a6c4..119d9a9b 100644 --- a/include/JSystem/JUtility/JUTGamePad.h +++ b/include/JSystem/JUtility/JUTGamePad.h @@ -100,11 +100,12 @@ class JUTGamePad : public JKRDisposer { } /* @HACK - This gets inlined when defined -- JSystem might have precompiled headers */ - static s8 getPortStatus(EPadPort port); - /*{ + + static s8 getPortStatus(EPadPort port) + { JUT_ASSERT(0 <= port && port < 4); return mPadStatus[port].err; - }*/ + } bool isPushing3ButtonReset() const { bool pushing = false; diff --git a/src/static/Famicom/famicom.cpp b/src/static/Famicom/famicom.cpp index 0dc878f9..6b1d0289 100644 --- a/src/static/Famicom/famicom.cpp +++ b/src/static/Famicom/famicom.cpp @@ -15,6 +15,7 @@ #include "JSystem/JKernel/JKRArchive.h" #include "JSystem/JKernel/JKRAram.h" #include "JSystem/ResTIMG.h" +#include "JSystem/J2D/J2DGrafContext.h" #include "libc64/sprintf.h" #include "libjsys/jsyswrapper.h" #include "jsyswrap_cpp.h" @@ -2325,11 +2326,7 @@ static int ksnes_thread_exec(u32 flags) { } } -inline int GetPortStatus(int port) { - JUTGamePad::EPadPort padPort = (JUTGamePad::EPadPort)port; - return JUTGamePad::getPortStatus(padPort); -} - +#pragma dont_inline on // @HACK - necessary to not inline JUTGamePad::getPortStatus static void nogbaInput() { int port; u32 disconnected_ports = 0; @@ -2337,7 +2334,8 @@ static void nogbaInput() { for (port = 0; port < PAD_MAX_CONTROLLERS; port++) { InputValid[port] = false; - switch (GetPortStatus(port)) { + // switch (GetPortStatus(port)) { + switch ((int)JUTGamePad::getPortStatus((JUTGamePad::EPadPort)port)) { case PAD_ERR_NONE: { InputValid[port] = true; @@ -2396,6 +2394,14 @@ static void nogbaInput() { } } } +#pragma dont_inline reset + +// @HACK - we need to force J2DOrthoGraph's dtor to emit +static void fake() { + J2DOrthoGraph graph; + + graph.~J2DOrthoGraph(); +} extern void famicom_1frame() { nogbaInput();