Skip to content

Commit

Permalink
Fix f3dex2 crash caused by using gDPNoOp disp macros when GBI_DEBUG w…
Browse files Browse the repository at this point in the history
…as not defined (#145)
  • Loading branch information
Thar0 authored Jul 18, 2024
1 parent 4caa048 commit 4412521
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ else ifeq ($(VERSION),gc-eu-mq-dbg)
CPP_DEFINES += -DOOT_MQ
HACKEROOT := 0
else ifeq ($(VERSION),hackeroot-mq)
DEBUG := 1
CPP_DEFINES += -DOOT_MQ
HACKEROOT := 1
else
Expand Down
4 changes: 4 additions & 0 deletions src/code/graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,16 +498,19 @@ void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size) {

#if IS_DEBUG
void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line) {
#if GBI_DEBUG
dispRefs[0] = gfxCtx->polyOpa.p;
dispRefs[1] = gfxCtx->polyXlu.p;
dispRefs[2] = gfxCtx->overlay.p;

gDPNoOpOpenDisp(gfxCtx->polyOpa.p++, file, line);
gDPNoOpOpenDisp(gfxCtx->polyXlu.p++, file, line);
gDPNoOpOpenDisp(gfxCtx->overlay.p++, file, line);
#endif
}

void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line) {
#if GBI_DEBUG
if (dispRefs[0] + 1 == gfxCtx->polyOpa.p) {
gfxCtx->polyOpa.p = dispRefs[0];
} else {
Expand All @@ -525,5 +528,6 @@ void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file,
} else {
gDPNoOpCloseDisp(gfxCtx->overlay.p++, file, line);
}
#endif
}
#endif

0 comments on commit 4412521

Please sign in to comment.