Skip to content

Commit

Permalink
some fixes for widescreen support in intro
Browse files Browse the repository at this point in the history
  • Loading branch information
freshollie committed Nov 25, 2024
1 parent 3aca622 commit 4508686
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions include/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/game/stage/background/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 7 additions & 7 deletions src/game/stage/game_7.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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++) {
Expand All @@ -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
Expand Down Expand Up @@ -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));
Expand All @@ -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++) {
Expand All @@ -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--;
Expand All @@ -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
Expand Down

0 comments on commit 4508686

Please sign in to comment.