Skip to content

Commit 207c638

Browse files
committed
Align core.c data with SA3
1 parent 2e2913b commit 207c638

File tree

1 file changed

+33
-8
lines changed

1 file changed

+33
-8
lines changed

src/core.c

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515

1616
typedef bool32 (*VBlankProcessFunc)(void);
1717

18-
// TODO: the order of these vars has
19-
// been shuffled due to compilation losses.
20-
// It's possible to use `ramscrgen` to reorder
21-
// these variables in here and provide
22-
// the matching order separately
2318
IntrFunc gIntrTable[] = {};
2419
u32 gIntrMainBuf[] = {};
2520
struct Task gTasks[] = {};
@@ -37,7 +32,6 @@ u16 gVramHeapMaxTileSlots = 0;
3732
u8 gNumHBlankCallbacks ALIGNED(4) = 0;
3833
union MultiSioData gMultiSioRecv[4] = {};
3934
#if (ENGINE == ENGINE_3)
40-
u8 gUnknown_03002BE0[] = { 0 }; // unused?
4135
u32 gUnknown_03002BF0 = 0;
4236
#endif
4337
u8 gNumHBlankIntrs = 0;
@@ -55,6 +49,9 @@ u16 SA2_LABEL(gUnknown_03001944) ALIGNED(4) = 0;
5549
u8 gNumVBlankIntrs ALIGNED(4) = 0;
5650
s16 SA2_LABEL(gUnknown_0300194C) ALIGNED(4) = 0;
5751

52+
#if (ENGINE >= ENGINE_3)
53+
u8 gUnknown_03002C60 ALIGNED(4) = 0;
54+
#endif
5855
u32 gMultiSioStatusFlags = 0;
5956
bool8 gMultiSioEnabled = FALSE;
6057

@@ -67,11 +64,21 @@ winreg_t gWinRegs[6] ALIGNED(16) = {};
6764
s32 gNumTasks = 0;
6865
u8 gBgSprites_Unknown2[4][4] = {};
6966
u16 gInput = 0;
67+
#if (ENGINE >= ENGINE_3)
68+
s32 gUnknown_030035A4 = 0;
69+
struct Task *gNextTaskToCheckForDestruction = NULL;
70+
#endif // (ENGINE >= ENGINE_3)
7071
u8 gRepeatedKeysTestCounter[] ALIGNED(16) = {};
7172
void *gBgOffsetsHBlankSecondary = NULL;
7273
u16 gBgCntRegs[] = {};
7374
u16 gRepeatedKeys ALIGNED(4) = 0;
7475
struct Task *gNextTask = NULL;
76+
#if ((ENGINE == ENGINE_1) || (ENGINE == ENGINE_2))
77+
// Only here in SA3
78+
// struct GraphicsData *gVramGraphicsCopyQueue[];
79+
#else
80+
struct GraphicsData gVramGraphicsCopyQueue[] = {};
81+
#endif
7582
#if (ENGINE == ENGINE_2)
7683
void *gBgOffsetsSecondary = NULL;
7784
#endif
@@ -93,10 +100,20 @@ u32 gFlagsPreVBlank = 0;
93100
/* 0x03002794 */ const struct SpriteTables *gRefSpriteTables = NULL;
94101

95102
#if PORTABLE
96-
struct GraphicsData gVramGraphicsCopyQueueBuffer[32] = {};
97-
#endif
103+
// TODO: Once SA3 works in PORTABLE, it can just use
104+
// the regular gVramGraphicsCopyQueue[].
105+
struct GraphicsData gVramGraphicsCopyQueueBuffer[] = {};
106+
#endif // PORTABLE
107+
#if ((ENGINE == ENGINE_1) || (ENGINE == ENGINE_2))
98108
struct GraphicsData *gVramGraphicsCopyQueue[] ALIGNED(16) = {};
109+
#else
110+
// NOT here in SA3
111+
// struct GraphicsData gVramGraphicsCopyQueue[32] = {};
112+
#endif
99113

114+
#if (ENGINE == ENGINE_3)
115+
VoidFn gUnknown_03003C08 = NULL;
116+
#endif
100117
s16 SA2_LABEL(gUnknown_03002820) = 0;
101118
s16 gBgScrollRegs[][2] ALIGNED(16) = {};
102119
u16 gDispCnt = 0;
@@ -106,6 +123,11 @@ u8 SA2_LABEL(gUnknown_03002874) = 0;
106123

107124
void *gHBlankCopyTarget ALIGNED(4) = NULL;
108125

126+
#if (ENGINE == ENGINE_3)
127+
// Name inferred from KATAM
128+
u16 gRgbMap[3][2 * 16] __attribute__((aligned(4))) = {};
129+
#endif // (ENGINE == ENGINE_3)
130+
109131
u8 gBackgroundsCopyQueueIndex = 0;
110132
u16 gBgPalette[] ALIGNED(16) = {};
111133

@@ -131,6 +153,9 @@ void *gBgOffsetsPrimary = NULL;
131153
#endif
132154
u16 SA2_LABEL(gUnknown_03004D58) ALIGNED(4) = 0;
133155
u8 gVramGraphicsCopyCursor ALIGNED(4) = 0;
156+
#if (ENGINE == ENGINE_3)
157+
u8 gUnknown_0300620C ALIGNED(4) = 0;
158+
#endif
134159
u8 gOamMallocOrders_EndIndex[] ALIGNED(16) = {};
135160
u8 gBgSprites_Unknown1[] = {};
136161
OamData gOamBuffer[] ALIGNED(16) = {};

0 commit comments

Comments
 (0)