From 4508686f71c001fe499f92b3d3a172a71eae4f18 Mon Sep 17 00:00:00 2001 From: Oliver Bell Date: Mon, 25 Nov 2024 00:07:05 +0000 Subject: [PATCH] some fixes for widescreen support in intro --- include/core.h | 4 ++-- src/core.c | 6 +++--- src/game/stage/background/callbacks.c | 2 +- src/game/stage/game_7.c | 14 +++++++------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/core.h b/include/core.h index ce27ee568..ca6fa4e34 100644 --- a/include/core.h +++ b/include/core.h @@ -257,7 +257,7 @@ extern OamData gOamBuffer2[OAM_ENTRY_COUNT]; extern OamData gOamBuffer[OAM_ENTRY_COUNT]; // NOTE(Jace): This could be u16[2][DISPLAY_HEIGHT][2] (or unsigned Vec2_16?) -extern u32 gBgOffsetsBuffer[2][DISPLAY_HEIGHT]; +extern int_vcount gBgOffsetsBuffer[2][DISPLAY_HEIGHT][4]; extern Background *gBackgroundsCopyQueue[16]; // This is used to buffer the xy-shift for each background scanline @@ -338,7 +338,7 @@ extern struct GraphicsData gVramGraphicsCopyQueueBuffer[32]; gBackgroundsCopyQueue[gBackgroundsCopyQueueIndex] = _bg; \ INC_BACKGROUNDS_QUEUE_CURSOR(gBackgroundsCopyQueueIndex); -extern u16 *gUnknown_030022AC; +extern void *gUnknown_030022AC; extern void *gUnknown_030022C0; extern s16 gMosaicReg; extern u8 gUnknown_030026F4; diff --git a/src/core.c b/src/core.c index 0600bcae9..dfe1ce94f 100644 --- a/src/core.c +++ b/src/core.c @@ -45,7 +45,7 @@ u32 gMultiSioStatusFlags = 0; bool8 gMultiSioEnabled = FALSE; struct Task *gTaskPtrs[] ALIGNED(16) = {}; -u32 gBgOffsetsBuffer[2][DISPLAY_HEIGHT] = {}; /* TODO: Find out how this is different from gBgOffsetsHBlank */ +int_vcount gBgOffsetsBuffer[2][DISPLAY_HEIGHT][4] = {}; /* TODO: Find out how this is different from gBgOffsetsHBlank */ u16 gObjPalette[] = {}; Tilemap **gTilemapsRef = NULL; u32 gFrameCount = 0; @@ -54,7 +54,7 @@ s32 gNumTasks = 0; u8 gUnknown_03002280[4][4] = {}; u16 gInput = 0; u8 gRepeatedKeysTestCounter[] ALIGNED(16) = {}; -u16 *gUnknown_030022AC = NULL; +void *gUnknown_030022AC = NULL; u16 gBgCntRegs[] = {}; u16 gRepeatedKeys ALIGNED(4) = 0; struct Task *gNextTask = NULL; @@ -297,7 +297,7 @@ void GameInit(void) DmaFill32(3, 0, &gBgOffsetsBuffer, sizeof(gBgOffsetsBuffer)); gBgOffsetsHBlank = gBgOffsetsBuffer[0]; - gUnknown_030022AC = (void *)gBgOffsetsBuffer[1]; + gUnknown_030022AC = gBgOffsetsBuffer[1]; gUnknown_03002878 = NULL; gUnknown_03002A80 = 0; gNumHBlankCallbacks = 0; diff --git a/src/game/stage/background/callbacks.c b/src/game/stage/background/callbacks.c index 758d3e070..9c8c6b6dd 100644 --- a/src/game/stage/background/callbacks.c +++ b/src/game/stage/background/callbacks.c @@ -27,7 +27,7 @@ void HBlankCB_801E434(int_vcount vcount) void HBlankCB_801E454(int_vcount vcount) { if (vcount != 0) { - u16 *p = &gUnknown_030022AC[vcount * 2], *q; + u16 *p = &((u16 *)gUnknown_030022AC)[vcount * 2], *q; q = p - 1; if (p[1] != *q) { diff --git a/src/game/stage/game_7.c b/src/game/stage/game_7.c index cb85e4dbc..6c8ec4054 100644 --- a/src/game/stage/game_7.c +++ b/src/game/stage/game_7.c @@ -19,7 +19,7 @@ void sub_802DBC0(u8 p0, u16 p1) if (r6 == 0 || r6 == 1) { s16 i; - bgOffsets = &bgOffsets[p0 * sizeof(u16)]; + bgOffsets = &bgOffsets[p0 * 2]; #ifndef NON_MATCHING asm("" : "=r"(r5)); @@ -46,7 +46,7 @@ void sub_802DBC0(u8 p0, u16 p1) r3 = ABS(r3); if (r6 < Q(2.0)) { - bgOffsets = &bgOffsets[p0 * sizeof(u16)]; + bgOffsets = &bgOffsets[p0 * 2]; // __0802DC56 for (i = p0; i < DISPLAY_HEIGHT; i++) { @@ -66,7 +66,7 @@ void sub_802DBC0(u8 p0, u16 p1) } } else { // _0802DC90 - bgOffsets = &bgOffsets[p0 * sizeof(u16)]; + bgOffsets = &bgOffsets[p0 * 2]; for (i = p0; i >= 0; i--) { // _0802DC9C @@ -180,7 +180,7 @@ void sub_802DDC4(u8 p0, u16 p1) if ((r6 - Q(2.0)) == 0 || (r6 - Q(2.0)) == 1) { s16 i; - bgOffsets = &bgOffsets[p0 * sizeof(u16)]; + bgOffsets = &bgOffsets[p0 * 2]; #ifndef NON_MATCHING asm("" : "=r"(r5)); @@ -207,7 +207,7 @@ void sub_802DDC4(u8 p0, u16 p1) } if (r6 < Q(2.0)) { - bgOffsets = &bgOffsets[p0 * sizeof(u16)]; + bgOffsets = &bgOffsets[p0 * 2]; // __0802DC56 for (i = p0; i < DISPLAY_HEIGHT; i++) { @@ -226,7 +226,7 @@ void sub_802DDC4(u8 p0, u16 p1) } } else { // _0802DC90 - bgOffsets = &bgOffsets[DISPLAY_HEIGHT * sizeof(u16)]; + bgOffsets = &bgOffsets[DISPLAY_HEIGHT * 2]; for (i = DISPLAY_HEIGHT; i > p0; i--) { bgOffsets--; @@ -235,7 +235,7 @@ void sub_802DDC4(u8 p0, u16 p1) } bgOffsets = gBgOffsetsHBlank; - bgOffsets += p0 * sizeof(u16); + bgOffsets += p0 * 2; for (i = p0; i >= 0; i--) { // _0802DC9C