diff options
author | YamaArashi <shadow962@live.com> | 2016-09-25 12:06:59 -0700 |
---|---|---|
committer | YamaArashi <shadow962@live.com> | 2016-09-25 12:06:59 -0700 |
commit | a5727f581bb76e0a2240f3a352204689d18a25e2 (patch) | |
tree | 077c23ac87136164b76739af1aaf7530d1575c90 | |
parent | 012896c6d89e9ced8c712edfe32595fd81c27882 (diff) |
define more variables in C
-rw-r--r-- | asm/rom3.s | 2 | ||||
-rw-r--r-- | asm/rom5.s | 32 | ||||
-rw-r--r-- | asm/rom_8040EB4.s | 2 | ||||
-rw-r--r-- | asm/rom_8074BAC.s | 8 | ||||
-rw-r--r-- | common_syms/rng.txt | 1 | ||||
-rw-r--r-- | src/menu.c | 15 | ||||
-rw-r--r-- | src/palette.c | 8 | ||||
-rw-r--r-- | src/play_time.c | 12 | ||||
-rw-r--r-- | src/rng.c | 2 | ||||
-rw-r--r-- | src/script.c | 8 | ||||
-rw-r--r-- | sym_bss.txt | 17 | ||||
-rw-r--r-- | sym_common.txt | 4 | ||||
-rw-r--r-- | sym_ewram.txt | 74 |
13 files changed, 59 insertions, 126 deletions
diff --git a/asm/rom3.s b/asm/rom3.s index f88bd19a4..af1886f99 100644 --- a/asm/rom3.s +++ b/asm/rom3.s @@ -4167,7 +4167,7 @@ _0800D7A4: .4byte 0x00007fe0 _0800D7A8: .4byte 0x00002529 _0800D7AC: .4byte 0x00007fff _0800D7B0: .4byte 0x0000675a -_0800D7B4: .4byte gUnknown_0202EF80 +_0800D7B4: .4byte gPlttBufferFaded + 0xB8 thumb_func_end sub_800D74C thumb_func_start sub_800D7B8 diff --git a/asm/rom5.s b/asm/rom5.s index 106a96d95..fe19def2e 100644 --- a/asm/rom5.s +++ b/asm/rom5.s @@ -3402,7 +3402,7 @@ _0807C8E4: .align 2, 0 _0807C8EC: .4byte sub_807CA34 _0807C8F0: .4byte gUnknown_083970E8 -_0807C8F4: .4byte gUnknown_0202ECC8 +_0807C8F4: .4byte gPlttBufferUnfaded + 0x200 _0807C8F8: .4byte REG_BG0CNT _0807C8FC: .4byte gUnknown_0202F7E8 _0807C900: .4byte 0x000006d5 @@ -41996,7 +41996,7 @@ _0808F50C: b _0808F67C .align 2, 0 _0808F524: .4byte gUnknown_083A05F8 -_0808F528: .4byte gUnknown_0202EACA +_0808F528: .4byte gPlttBufferUnfaded + 0x2 _0808F52C: ldr r0, _0808F56C lsls r1, r4, 2 @@ -98924,7 +98924,7 @@ _080AB364: bx r0 .align 2, 0 _080AB38C: .4byte gWindowConfig_81E6FD8 -_080AB390: .4byte gUnknown_0202ECAA +_080AB390: .4byte gPlttBufferUnfaded + 0x1E2 _080AB394: .4byte 0x00007e3f thumb_func_end sub_80AB350 @@ -99545,7 +99545,7 @@ _080AB844: b _080AB946 .align 2, 0 _080AB8AC: .4byte gUnknown_08D17144 -_080AB8B0: .4byte gUnknown_0202EBC8 +_080AB8B0: .4byte gPlttBufferUnfaded + 0x100 _080AB8B4: .4byte REG_BG0CNT _080AB8B8: .4byte gUnknown_02038695 _080AB8BC: .4byte 0xffffff00 @@ -109307,8 +109307,8 @@ sub_80B05A4: @ 80B05A4 pop {r0} bx r0 .align 2, 0 -_080B05E8: .4byte gUnknown_0202EADC -_080B05EC: .4byte gUnknown_0202EEDC +_080B05E8: .4byte gPlttBufferUnfaded + 0x14 +_080B05EC: .4byte gPlttBufferFaded + 0x14 _080B05F0: .4byte 0x040000d4 _080B05F4: .4byte 0x80000001 thumb_func_end sub_80B05A4 @@ -169104,7 +169104,7 @@ _080CD5D8: b _080CD648 .align 2, 0 _080CD634: .4byte 0x00007fff -_080CD638: .4byte gUnknown_0202ECD8 +_080CD638: .4byte gPlttBufferUnfaded + 0x210 _080CD63C: .4byte 0x00000101 _080CD640: cmp r0, 0 @@ -310756,7 +310756,7 @@ _08111C70: .4byte nullsub_37 _08111C74: .4byte sub_811240C _08111C78: .4byte gTasks _08111C7C: .4byte 0x02009000 -_08111C80: .4byte gUnknown_0202EB08 +_08111C80: .4byte gPlttBufferUnfaded + 0x40 _08111C84: .4byte nullsub_73 _08111C88: .4byte sub_8114FD4 _08111C8C: .4byte sub_8112270 @@ -311990,7 +311990,7 @@ _08112762: b _08112992 .align 2, 0 _08112794: .4byte gTasks -_08112798: .4byte gUnknown_0202EB08 +_08112798: .4byte gPlttBufferUnfaded + 0x40 _0811279C: .4byte 0x02009000 _081127A0: bl sub_8075374 @@ -313295,7 +313295,7 @@ _081132E2: bl _08113B3A .align 2, 0 _081132EC: .4byte gTasks -_081132F0: .4byte gUnknown_0202EB08 +_081132F0: .4byte gPlttBufferUnfaded + 0x40 _081132F4: .4byte 0x02009000 _081132F8: bl sub_8075374 @@ -396203,7 +396203,7 @@ _0813BC70: .4byte 0x00009201 _0813BC74: .4byte gUnknown_0840B008 _0813BC78: .4byte gUnknown_0840B018 _0813BC7C: .4byte gUnknown_0840B028 -_0813BC80: .4byte gUnknown_0202ECC8 +_0813BC80: .4byte gPlttBufferUnfaded + 0x200 _0813BC84: .4byte gTasks _0813BC88: .4byte task_intro_2 thumb_func_end task_intro_1 @@ -424406,8 +424406,8 @@ sub_8149C50: @ 8149C50 bx r0 .align 2, 0 _08149C98: .4byte gTasks -_08149C9C: .4byte gUnknown_0202EF08 -_08149CA0: .4byte gUnknown_0202EB08 +_08149C9C: .4byte gPlttBufferFaded + 0x40 +_08149CA0: .4byte gPlttBufferUnfaded + 0x40 _08149CA4: .4byte 0xfff9001c _08149CA8: .4byte 0x00007fff _08149CAC: .4byte sub_8149CB0 @@ -424567,8 +424567,8 @@ sub_8149D8C: @ 8149D8C bx r0 .align 2, 0 _08149DD4: .4byte gTasks -_08149DD8: .4byte gUnknown_0202EF08 -_08149DDC: .4byte gUnknown_0202EB08 +_08149DD8: .4byte gPlttBufferFaded + 0x40 +_08149DDC: .4byte gPlttBufferUnfaded + 0x40 _08149DE0: .4byte 0xfff90001 _08149DE4: .4byte 0x00007fff _08149DE8: .4byte sub_8149DEC @@ -424809,7 +424809,7 @@ _08149FB4: .4byte 0x00007fff _08149FB8: .4byte gTasks _08149FBC: .4byte gSprites _08149FC0: .4byte nullsub_85 -_08149FC4: .4byte gUnknown_0202F0C8 +_08149FC4: .4byte gPlttBufferFaded + 0x200 thumb_func_end sub_8149E7C thumb_func_start sub_8149FC8 diff --git a/asm/rom_8040EB4.s b/asm/rom_8040EB4.s index 83ff8da4a..38a57cd9e 100644 --- a/asm/rom_8040EB4.s +++ b/asm/rom_8040EB4.s @@ -9375,7 +9375,7 @@ _080457BA: .align 2, 0 _080457C8: .4byte gSprites _080457CC: .4byte gBattleInterfaceStatusIcons_DynPal -_080457D0: .4byte gUnknown_0202ECC8 +_080457D0: .4byte gPlttBufferUnfaded + 0x200 _080457D4: .4byte 0x05000200 _080457D8: .4byte 0x06010000 _080457DC: .4byte REG_BG2HOFS diff --git a/asm/rom_8074BAC.s b/asm/rom_8074BAC.s index d07f83efd..0ddb5b7e1 100644 --- a/asm/rom_8074BAC.s +++ b/asm/rom_8074BAC.s @@ -2868,7 +2868,7 @@ _080761AC: .4byte gSprites _080761B0: .4byte 0x02019348 _080761B4: .4byte gUnknown_030041B4 _080761B8: .4byte REG_BG1HOFS -_080761BC: .4byte gUnknown_0202ECC8 +_080761BC: .4byte gPlttBufferUnfaded + 0x200 _080761C0: .4byte 0x84000008 _080761C4: mov r0, r9 @@ -3074,7 +3074,7 @@ _08076364: .4byte gUnknown_02024BE0 _08076368: .4byte gUnknown_03004288 _0807636C: .4byte gUnknown_03004280 _08076370: .4byte REG_BG2HOFS -_08076374: .4byte gUnknown_0202ECC8 +_08076374: .4byte gPlttBufferUnfaded + 0x200 _08076378: .4byte 0x05000120 _0807637C: .4byte 0x84000008 thumb_func_end sub_8076034 @@ -3412,7 +3412,7 @@ _080765FC: .4byte gTasks _08076600: .4byte gSprites _08076604: .4byte gUnknown_030042C0 _08076608: .4byte gUnknown_030041B4 -_0807660C: .4byte gUnknown_0202F0C8 +_0807660C: .4byte gPlttBufferFaded + 0x200 _08076610: .4byte 0xfffffe00 _08076614: ldr r1, _08076648 @@ -3445,7 +3445,7 @@ _08076634: .align 2, 0 _08076648: .4byte gUnknown_03004288 _0807664C: .4byte gUnknown_03004280 -_08076650: .4byte gUnknown_0202F0C8 +_08076650: .4byte gPlttBufferFaded + 0x200 _08076654: .4byte 0x040000d4 _08076658: .4byte 0x84000008 thumb_func_end task_pA_ma0A_obj_to_bg_pal diff --git a/common_syms/rng.txt b/common_syms/rng.txt new file mode 100644 index 000000000..794439ea5 --- /dev/null +++ b/common_syms/rng.txt @@ -0,0 +1 @@ +gRngValue diff --git a/src/menu.c b/src/menu.c index 75afb8acb..8bd6f3e90 100644 --- a/src/menu.c +++ b/src/menu.c @@ -92,13 +92,14 @@ extern void sub_814A7FC(void); static struct Menu gMenu; -extern struct Window gMenuWindow; -extern struct Window *gMenuWindowPtr; -extern u8 gMenuMultistepInitState; -extern u16 gMenuTextTileOffset; -extern u16 gMenuTextWindowTileOffset; -extern u16 gMenuTextWindowContentTileOffset; -extern u16 gMenuMessageBoxContentTileOffset; +EWRAM_DATA struct Window gMenuWindow = {0}; +EWRAM_DATA u8 gFiller_202E908[0x90] = {0}; +EWRAM_DATA struct Window *gMenuWindowPtr = NULL; +EWRAM_DATA u8 gMenuMultistepInitState = 0; +EWRAM_DATA u16 gMenuTextTileOffset = 0; +EWRAM_DATA u16 gMenuTextWindowTileOffset = 0; +EWRAM_DATA u16 gMenuTextWindowContentTileOffset = 0; +EWRAM_DATA u16 gMenuMessageBoxContentTileOffset = 0; extern const u8 *gUnknown_08376D74[][2]; diff --git a/src/palette.c b/src/palette.c index 33138d452..7db7f749a 100644 --- a/src/palette.c +++ b/src/palette.c @@ -40,7 +40,13 @@ struct PaletteStruct extern void sub_800D238(const void *src, void *dest); extern void BlendPalette(u16, u16, u8, u16); -extern struct PaletteStruct gPaletteStructs[]; +EWRAM_DATA u16 gPlttBufferUnfaded[0x200] = {0}; +EWRAM_DATA u16 gPlttBufferFaded[0x200] = {0}; +EWRAM_DATA struct PaletteStruct gPaletteStructs[0x10] = {0}; +EWRAM_DATA struct PaletteFadeControl gPaletteFade = {0}; +EWRAM_DATA u32 gFiller_202F394 = 0; +EWRAM_DATA u32 gPlttBufferTransferPending = 0; +EWRAM_DATA u8 gPaletteDecompressionBuffer[0x400] = {0}; extern struct PaletteStructTemplate gDummyPaletteStructTemplate; diff --git a/src/play_time.c b/src/play_time.c index f950e31a5..4eabf38cc 100644 --- a/src/play_time.c +++ b/src/play_time.c @@ -8,13 +8,13 @@ enum MAXED_OUT }; -extern u8 gPlayTimeCounterState; +static u8 sPlayTimeCounterState; void PlayTimeCounter_SetToMax(); void PlayTimeCounter_Reset() { - gPlayTimeCounterState = STOPPED; + sPlayTimeCounterState = STOPPED; gSaveBlock2.playTimeHours = 0; gSaveBlock2.playTimeMinutes = 0; @@ -24,7 +24,7 @@ void PlayTimeCounter_Reset() void PlayTimeCounter_Start() { - gPlayTimeCounterState = RUNNING; + sPlayTimeCounterState = RUNNING; if (gSaveBlock2.playTimeHours > 999) PlayTimeCounter_SetToMax(); @@ -32,12 +32,12 @@ void PlayTimeCounter_Start() void PlayTimeCounter_Stop() { - gPlayTimeCounterState = STOPPED; + sPlayTimeCounterState = STOPPED; } void PlayTimeCounter_Update() { - if (gPlayTimeCounterState == RUNNING) + if (sPlayTimeCounterState == RUNNING) { gSaveBlock2.playTimeVBlanks++; @@ -66,7 +66,7 @@ void PlayTimeCounter_Update() void PlayTimeCounter_SetToMax() { - gPlayTimeCounterState = MAXED_OUT; + sPlayTimeCounterState = MAXED_OUT; gSaveBlock2.playTimeHours = 999; gSaveBlock2.playTimeMinutes = 59; @@ -1,6 +1,8 @@ #include "global.h" #include "rng.h" +u32 gRngValue; + u16 Random(void) { gRngValue = 0x41c64e6d * gRngValue + 0x00006073; diff --git a/src/script.c b/src/script.c index e4be0442e..df2763a36 100644 --- a/src/script.c +++ b/src/script.c @@ -9,10 +9,10 @@ extern u16 VarGet(u16); extern u8 *gUnknown_0202E8AC; extern u32 gUnknown_0202E8B0; -extern u8 sScriptContext1Status; -extern struct ScriptContext sScriptContext1; -extern struct ScriptContext sScriptContext2; -extern bool8 sScriptContext2Enabled; +static u8 sScriptContext1Status; +static struct ScriptContext sScriptContext1; +static struct ScriptContext sScriptContext2; +static bool8 sScriptContext2Enabled; extern ScrCmdFunc gScriptCmdTable[]; extern ScrCmdFunc gScriptCmdTableEnd[]; diff --git a/sym_bss.txt b/sym_bss.txt index d440a7e9e..8cae646bb 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -48,9 +48,9 @@ gUnknown_0300055C: @ 300055C gUnknown_03000560: @ 3000560 .space 0x1C -gPlayTimeCounterState: @ 300057C - .space 0x4 + .include "src/play_time.o" + .align 2 gUnknown_03000580: @ 3000580 .space 0x4 @@ -83,20 +83,9 @@ gUnknown_030005A6: @ 30005A6 .include "src/field_message_box.o" .include "src/text_window.o" + .include "src/script.o" .align 2 -sScriptContext1Status: @ 30005B0 - .space 0x8 - -sScriptContext1: @ 30005B8 - .space 0x78 - -sScriptContext2: @ 3000630 - .space 0x74 - -sScriptContext2Enabled: @ 30006A4 - .space 0x4 - gUnknown_030006A8: @ 30006A8 .space 0x4 diff --git a/sym_common.txt b/sym_common.txt index 9c16648e2..880659b18 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -143,9 +143,9 @@ gUnknown_03004750: @ 3004750 gUnknown_030047B4: @ 30047B4 .space 0x64 -gRngValue: @ 3004818 - .space 0x4 + .include "rng.o" + .align 2 gUnknown_0300481C: @ 300481C .space 0x4 diff --git a/sym_ewram.txt b/sym_ewram.txt index ca8c7af03..9fac9ab93 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -715,81 +715,15 @@ gUnknown_0202E8FD: @ 202E8FD gUnknown_0202E8FE: @ 202E8FE .space 0xA -gMenuWindow: @ 202E908 - .space 0xC0 - -gMenuWindowPtr: @ 202E9C8 - .space 0x4 - -gMenuMultistepInitState: @ 202E9CC - .space 0x2 - -gMenuTextTileOffset: @ 202E9CE - .space 0x2 - -gMenuTextWindowTileOffset: @ 202E9D0 - .space 0x2 - -gMenuTextWindowContentTileOffset: @ 202E9D2 - .space 0x2 - -gMenuMessageBoxContentTileOffset: @ 202E9D4 - .space 0x4 + .include "src/menu.o" + .align 2 gUnknown_0202E9D8: @ 202E9D8 .space 0xF0 -gPlttBufferUnfaded: @ 202EAC8 - .space 0x2 - -gUnknown_0202EACA: @ 202EACA - .space 0x12 - -gUnknown_0202EADC: @ 202EADC - .space 0x2C - -gUnknown_0202EB08: @ 202EB08 - .space 0xC0 - -gUnknown_0202EBC8: @ 202EBC8 - .space 0xE2 - -gUnknown_0202ECAA: @ 202ECAA - .space 0x1E - -gUnknown_0202ECC8: @ 202ECC8 - .space 0x10 - -gUnknown_0202ECD8: @ 202ECD8 - .space 0x1F0 - -gPlttBufferFaded: @ 202EEC8 - .space 0x14 - -gUnknown_0202EEDC: @ 202EEDC - .space 0x2C - -gUnknown_0202EF08: @ 202EF08 - .space 0x78 - -gUnknown_0202EF80: @ 202EF80 - .space 0x148 - -gUnknown_0202F0C8: @ 202F0C8 - .space 0x200 - -gPaletteStructs: @ 202F2C8 - .space 0xC0 - -gPaletteFade: @ 202F388 - .space 0x10 - -gPlttBufferTransferPending: @ 202F398 - .space 0x4 - -gPaletteDecompressionBuffer: @ 202F39C - .space 0x400 + .include "src/palette.o" + .align 2 gUnknown_0202F79C: @ 202F79C .space 0x4 |