This commit is contained in:
DizzyEggg
2024-12-15 14:06:35 +01:00
parent d59d39a0d7
commit 385200e1d6
11 changed files with 65 additions and 66 deletions

View File

@@ -3,27 +3,6 @@
.global gUnknown_8270000
gUnknown_8270000: @ 8270000
@ replacing .incbin "baserom.gba", 0x00270000, 0x2724
.byte 0x01, 0x00, 0x00, 0x00
.byte 0x95, 0x1b, 0x00, 0x03
.byte 0xa5, 0x1c, 0x00, 0x03
.byte 0xd9, 0x1d, 0x00, 0x03
.byte 0xad, 0x1e, 0x00, 0x03
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0xff, 0xff
.byte 0xff, 0xff, 0xff, 0xff
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x41, 0x3e
.byte 0x42, 0x3c, 0x44, 0x3b
.byte 0x48, 0x37, 0x40, 0x30
.byte 0x46, 0x38, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00

View File

@@ -3,8 +3,9 @@
#include "random.h"
#include "reg_control.h"
EWRAM_DATA_2 u32 gUnknown_203B0B8 = {0};
EWRAM_DATA_2 u16 gRawKeyInput = {0};
// Todo: Figure out if this file could be merged with bg_control and cpu?
EWRAM_INIT u32 gUnknown_203B0B8 = {0};
extern u16 gRawKeyInput;
void sub_800CB20(void)
{

View File

@@ -3,14 +3,26 @@
#include "cpu.h"
EWRAM_DATA u32 gUnknown_202D800 = {0};
extern u16 gUnknown_203B0BE[];
EWRAM_INIT u16 gRawKeyInput = {0}; // Not used here, but has to be declare along with sBldCntTable for alignment. Perhaps this file should be merged with bg_control and code_800C9CC.
// Despite being in EWRAM, these never change.
static EWRAM_INIT u16 sBldCntTable[] = {
(BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_OBJ | BLDCNT_TGT2_BD),
(BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_OBJ | BLDCNT_TGT2_BD),
(BLDCNT_TGT1_BG2 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG0 | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_OBJ | BLDCNT_TGT2_BD),
(BLDCNT_TGT1_BG3 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG0 | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2 | BLDCNT_TGT2_OBJ | BLDCNT_TGT2_BD),
(BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_OBJ | BLDCNT_TGT2_BD),
(BLDCNT_TGT1_BG1 | BLDCNT_TGT1_BG2 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_OBJ | BLDCNT_TGT2_BD),
(0),
};
extern u16 *gUnknown_2026E3C;
extern u8 gUnknown_2026E38;
void sub_800CDA8(u32 r0)
{
gUnknown_202D800 = r0;
gBldCnt = gUnknown_203B0BE[r0];
gBldCnt = sBldCntTable[r0];
}
u32 sub_800CDC8(void)

View File

@@ -5,7 +5,7 @@
EWRAM_DATA u32 gUnknown_202D2A4 = {0};
EWRAM_DATA OpenedFile gFileCache[64] = {0};
static EWRAM_DATA_2 u32 sFileCacheCursorPosition = {0};
static EWRAM_INIT u32 sFileCacheCursorPosition = {0};
#include "data/file_system.h"
@@ -146,4 +146,4 @@ void CloseFile(OpenedFile *openedFile)
return;
}
}
}
}

View File

@@ -3,7 +3,7 @@
#include "flash.h"
#include "memory.h"
EWRAM_DATA_2 bool8 gFlashEnabled = {0};
EWRAM_INIT bool8 gFlashEnabled = {0};
extern FlashIntrFunc *GetInterruptHandler(s32);

View File

@@ -2,7 +2,7 @@
#include "globaldata.h"
#include "random.h"
EWRAM_DATA_2 s32 gPRNGSequenceNum = {0};
EWRAM_INIT s32 gPRNGSequenceNum = {1};
void SeedRng(u8 *seed)
{

View File

@@ -16,19 +16,19 @@ EWRAM_DATA IntrCallback gIntrCallbacks[6] = {0};
EWRAM_DATA unkStruct_202D648 gUnknown_202D608[8] = {0};
EWRAM_DATA unkStruct_202D648 gUnknown_202D648[8] = {0};
EWRAM_DATA_2 u8 gInterruptsEnabled = {0};
EWRAM_DATA_2 bool8 gUnknown_203B099 = {0};
EWRAM_DATA_2 bool8 gUnknown_203B09A = {0};
EWRAM_DATA_2 bool8 gUnknown_203B09B = {0};
EWRAM_DATA_2 u32 gUnknown_203B09C = {0};
EWRAM_DATA_2 u32 gUnknown_203B0A0 = {0};
EWRAM_DATA_2 u32 gUnknown_203B0A4 = {0}; // Written to but never read
EWRAM_DATA_2 s16 gUnknown_203B0A8 = {0};
EWRAM_DATA_2 s16 gUnknown_203B0AA = {0};
EWRAM_DATA_2 s16 gUnknown_203B0AC = {0};
EWRAM_DATA_2 s16 gUnknown_203B0AE = {0};
EWRAM_DATA_2 s16 gUnknown_203B0B0 = {0}; // Written to but never read
EWRAM_DATA_2 s16 gUnknown_203B0B2 = {0}; // Written to but never read
EWRAM_INIT u8 gInterruptsEnabled = {0};
EWRAM_INIT bool8 gUnknown_203B099 = {0};
EWRAM_INIT bool8 gUnknown_203B09A = {0};
EWRAM_INIT bool8 gUnknown_203B09B = {0};
EWRAM_INIT u32 gUnknown_203B09C = {0};
EWRAM_INIT u32 gUnknown_203B0A0 = {0};
EWRAM_INIT u32 gUnknown_203B0A4 = {0}; // Written to but never read
EWRAM_INIT s16 gUnknown_203B0A8 = {0};
EWRAM_INIT s16 gUnknown_203B0AA = {0};
EWRAM_INIT s16 gUnknown_203B0AC = {0};
EWRAM_INIT s16 gUnknown_203B0AE = {-1};
EWRAM_INIT s16 gUnknown_203B0B0 = {-1}; // Written to but never read
EWRAM_INIT s16 gUnknown_203B0B2 = {-1}; // Written to but never read
// code_800D090.c
extern void sub_800D6AC(void);

View File

@@ -41,6 +41,19 @@ EWRAM_DATA static u32 sTextShadowMask = 0; // Some text color info is stored; re
EWRAM_DATA static u8 sDrawTextShadow = 0;
EWRAM_DATA ALIGNED(4) u16 gUnknown_202B038[4][32][32] = {0};
extern ALIGNED(4) u8 gUnkIwramFunc1Buffer[];
extern ALIGNED(4) u8 gUnkIwramFunc2Buffer[];
extern ALIGNED(4) u8 gUnkIwramFunc3Buffer[];
extern ALIGNED(4) u8 gUnkIwramFunc4Buffer[];
// Despite these not being used anywhere in this file, file order and usage point to these variables being declared here
EWRAM_INIT void (*gUnknown_203B080)(s32 a0) = (void *) &gUnkIwramFunc1Buffer[1]; // + 1 because the function is in thumb!
EWRAM_INIT void (*gUnknown_203B084)(s32 a0) = (void *) &gUnkIwramFunc2Buffer[1]; // + 1 because the function is in thumb!
EWRAM_INIT void (*gUnknown_203B088)(s32 a0) = (void *) &gUnkIwramFunc3Buffer[1]; // + 1 because the function is in thumb!
EWRAM_INIT void (*gUnknown_203B08C)(s32 a0) = (void *) &gUnkIwramFunc4Buffer[1]; // + 1 because the function is in thumb!
// This variable is only used in InitGraphics function, which could or could not belong to text.c
EWRAM_INIT u8 gUnknown_203B090 = 0;
static void SaveUnkTextStructAndXXX_8006438(const UnkTextStruct2 *a0, bool8 a1, bool8 a2, UnkTextStruct2_sub *a3);
static void sub_8006554(UnkTextStruct1 *a0, u32 *a1, u32 *a2, u16 *a3, u32 a4, const UnkTextStruct2 *a5, bool8 a6, u32 a7, UnkTextStruct2_sub *a8, u8 a9);
static void sub_800677C(UnkTextStruct1 *a0, s32 a1, u16 *a2, u8 a3);

View File

@@ -1,30 +1,8 @@
.align 2
.include "src/random.o"
gUnknown_203B080: /* 203B080 (sub_8053540 - sub_806806C) */
.space 0x4
gUnknown_203B084: /* 203B084 (sub_8053430 - sub_806806C) */
.space 0x4
gUnknown_203B088: /* 203B088 (xxx_draw_string_80144C4) */
.space 0x4
gUnknown_203B08C: /* 203B08C (xxx_draw_string_80524F0) */
.space 0x4
gUnknown_203B090: /* 203B090 (InitGraphics) */
.space 0x4
.include "src/file_system.o"
.include "src/main.o"
.include "src/reg_control.o"
.include "src/flash.o"
.include "src/code_800C9CC.o"
gUnknown_203B0BE: /* 203B0BE (sub_800CDA8) */
.space 0xE
gUnknown_203B0CC: /* 203B0CC (sub_800DE8C - sub_800DC14) */
.space 0x4

View File

@@ -4,4 +4,11 @@
.include "src/other_random.o"
.include "src/sprite.o"
.include "src/code_800558C.o"
.include "src/random.o"
.include "src/text.o"
.include "src/file_system.o"
.include "src/main.o"
.include "src/reg_control.o"
.include "src/flash.o"
.include "src/code_800C9CC.o"
.include "src/cpu.o"

View File

@@ -46,6 +46,15 @@ gGroundEffects: /* 3001B8C */
.space 0x4
gGroundEvents: /* 3001B90 */
.space 0x2470
.space 0x4
gUnkIwramFunc1Buffer: /* 3001B94 */
.space 0x110
gUnkIwramFunc2Buffer: /* 3001CA4 */
.space 0x134
gUnkIwramFunc3Buffer: /* 3001DD8 */
.space 0xD4
gUnkIwramFunc4Buffer: /* 3001EAC */
.space 0x2154
.include "src/code_80001DC.o"