diff --git a/asm/battle_1.s b/asm/battle_1.s index 9665b0d11..ea69e73c8 100644 --- a/asm/battle_1.s +++ b/asm/battle_1.s @@ -366,7 +366,7 @@ sub_8034EFC: @ 8034EFC movs r0, 0 strh r0, [r1] lsls r1, r5, 3 - ldr r2, =gUnknown_030022F8 + ldr r2, =gMain+0x38 mov r9, r2 add r1, r9 mov r0, r8 diff --git a/asm/cable_car_util.s b/asm/cable_car_util.s index 7f396b635..db434eaf9 100644 --- a/asm/cable_car_util.s +++ b/asm/cable_car_util.s @@ -252,7 +252,7 @@ _0815226C: ldrb r2, [r2] cmp r3, r2 bcs _08152292 - ldr r0, =gUnknown_030024F8 + ldr r0, =gMain+0x238 mov r12, r0 ldr r4, =gDummyOamData adds r2, r5, 0 @@ -350,7 +350,7 @@ _08152322: cmp r0, 0 beq _08152348 lsls r0, r6, 3 - ldr r1, =gUnknown_030024F8 + ldr r1, =gMain+0x238 adds r0, r1 ldr r1, =gDummyOamData ldm r1!, {r2,r3} @@ -412,7 +412,7 @@ _08152348: orrs r0, r1 strh r0, [r2, 0x4] lsls r1, r6, 3 - ldr r2, =gUnknown_030024F8 + ldr r2, =gMain+0x238 ldr r0, [r4, 0x4] adds r1, r2 adds r0, r5, r0 @@ -746,7 +746,7 @@ _081525FC: orrs r0, r2 strb r0, [r1, 0x19] lsls r1, r5, 3 - ldr r0, =gUnknown_030024F8 + ldr r0, =gMain+0x238 adds r1, r0 ldr r0, =gDummyOamData ldm r0!, {r2,r3} diff --git a/asm/link.s b/asm/link.s index f4fb4b75d..55e91d8ce 100644 --- a/asm/link.s +++ b/asm/link.s @@ -3426,7 +3426,7 @@ HandleLinkConnection: @ 800B40C bl sub_800B638 ldr r4, =gUnknown_030030E0 str r0, [r4] - ldr r0, =gUnknown_030022EC + ldr r0, =gMain+0x2c bl sub_80099E0 ldr r0, [r4] movs r1, 0x80 diff --git a/asm/rom4.s b/asm/rom4.s index bf682fc51..fdb8d7a60 100644 --- a/asm/rom4.s +++ b/asm/rom4.s @@ -3180,7 +3180,7 @@ CB2_NewGame: @ 8085EF8 ldr r1, =gUnknown_03005DB0 movs r0, 0 str r0, [r1] - ldr r0, =gUnknown_030026F8 + ldr r0, =gMain+0x438 bl do_load_map_stuff_loop bl SetFieldVBlankCallback ldr r0, =c1_overworld @@ -3255,7 +3255,7 @@ c2_load_new_map: @ 8085FCC thumb_func_start c2_load_new_map_2 c2_load_new_map_2: @ 8085FFC push {lr} - ldr r0, =gUnknown_030026F8 + ldr r0, =gMain+0x438 bl do_load_map_stuff_loop bl SetFieldVBlankCallback ldr r0, =c1_overworld @@ -3317,7 +3317,7 @@ sub_8086074: @ 8086074 thumb_func_start c2_80567AC c2_80567AC: @ 8086098 push {lr} - ldr r0, =gUnknown_030026F8 + ldr r0, =gMain+0x438 bl map_loading_iteration_3 cmp r0, 0 beq _080860B8 @@ -3356,7 +3356,7 @@ _080860EA: thumb_func_start c2_exit_to_overworld_2_local c2_exit_to_overworld_2_local: @ 80860F4 push {lr} - ldr r0, =gUnknown_030026F8 + ldr r0, =gMain+0x438 bl sub_8086638 cmp r0, 0 beq _0808610A @@ -3375,7 +3375,7 @@ c2_exit_to_overworld_2_link: @ 8086118 bl sub_8087598 cmp r0, 0 bne _08086132 - ldr r0, =gUnknown_030026F8 + ldr r0, =gMain+0x438 bl map_loading_iteration_2_link cmp r0, 0 beq _08086132 diff --git a/asm/start_menu.s b/asm/start_menu.s index 4f8544eea..3c8c4c3cf 100644 --- a/asm/start_menu.s +++ b/asm/start_menu.s @@ -1615,7 +1615,7 @@ _080A0506: thumb_func_start sub_80A0514 sub_80A0514: @ 80A0514 push {lr} - ldr r0, =gUnknown_030026F8 + ldr r0, =gMain+0x438 bl sub_80A03E4 cmp r0, 0 beq _080A052E diff --git a/common_syms/main.txt b/common_syms/main.txt new file mode 100644 index 000000000..8e0b9abf5 --- /dev/null +++ b/common_syms/main.txt @@ -0,0 +1,9 @@ +gKeyRepeatStartDelay +gUnknown_030022B4 +gMain +gKeyRepeatContinueDelay +gSoftResetDisabled +gIntrTable +gUnknown_03002748 +IntrMain_Buffer +gPcmDmaCounter diff --git a/include/main.h b/include/main.h index 4ce2e9b1a..4b95b1919 100644 --- a/include/main.h +++ b/include/main.h @@ -50,7 +50,13 @@ extern bool8 gLinkVSyncDisabled; extern const u8 gGameVersion; extern const u8 gGameLanguage; -extern IWRAM_DATA u8 gUnknown_03002748; +extern u16 gKeyRepeatStartDelay; +extern u8 gUnknown_030022B4; +extern u16 gKeyRepeatContinueDelay; +extern IntrFunc gIntrTable[]; +extern u8 gUnknown_03002748; +extern u32 IntrMain_Buffer[]; +extern u8 gPcmDmaCounter; void AgbMain(void); void SetMainCallback2(MainCallback callback); diff --git a/src/main.c b/src/main.c index 665a4dd84..80993f0d0 100644 --- a/src/main.c +++ b/src/main.c @@ -38,7 +38,6 @@ extern u8 gHeap[]; extern struct SaveBlock2 gSaveblock2; extern struct PokemonStorage gPokemonStorage; extern u32 gBattleTypeFlags; -extern u8 gUnknown_03002748; extern u32 *gUnknown_0203CF5C; void Timer3Intr(void); @@ -79,19 +78,19 @@ const IntrFunc gIntrTableTemplate[] = static u16 gUnknown_03000000; -extern u16 gKeyRepeatStartDelay; -extern u8 gUnknown_030022B4; -extern struct Main gMain; -extern u16 gKeyRepeatContinueDelay; -extern u8 gSoftResetDisabled; -extern IntrFunc gIntrTable[INTR_COUNT]; -extern bool8 gLinkVSyncDisabled; -extern u32 IntrMain_Buffer[0x200]; -extern u8 gPcmDmaCounter; +u16 gKeyRepeatStartDelay; +u8 gUnknown_030022B4; +struct Main gMain; +u16 gKeyRepeatContinueDelay; +bool8 gSoftResetDisabled; +IntrFunc gIntrTable[INTR_COUNT]; +u8 gUnknown_03002748; +u32 IntrMain_Buffer[0x200]; +u8 gPcmDmaCounter; -extern u16 gTrainerId; +static EWRAM_DATA u16 gTrainerId = 0; -EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL; +//EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL; static void UpdateLinkAndCallCallbacks(void); static void InitMainCallbacks(void); diff --git a/sym_common.txt b/sym_common.txt index 1a199dbb3..929ce0e97 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -1,44 +1,5 @@ .space 0x8 - -gKeyRepeatStartDelay: @ 30022B0 - .space 0x4 - -gUnknown_030022B4: @ 30022B4 - .space 0xC - -gMain: @ 30022C0 - .space 0x2C - -gUnknown_030022EC: @ 30022EC - .space 0xC - -gUnknown_030022F8: @ 30022F8 - .space 0x200 - -gUnknown_030024F8: @ 30024F8 - .space 0x200 - -gUnknown_030026F8: @ 30026F8 - .space 0x4 - -gKeyRepeatContinueDelay: @ 30026FC - .space 0x4 - -gSoftResetDisabled: @ 3002700 - .space 0x10 - -gIntrTable: @ 3002710 - .space 0x38 - -gUnknown_03002748: @ 3002748 - .space 0x8 - -IntrMain_Buffer: @ 3002750 - .space 0x800 - -gPcmDmaCounter: @ 3002F50 - .space 0x4 - + .include "main.o" .include "bg.o" .align 4 diff --git a/sym_ewram.txt b/sym_ewram.txt index 52d24a9ab..a293ce9ec 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1,8 +1,5 @@ .include "src/decompress.o" - -gTrainerId: @ 2020000 - .space 0x4 - + .include "src/main.o" .include "src/window.o" .include "src/text.o" .include "src/sprite.o"