diff options
author | Evan <eroelke@gmail.com> | 2019-11-18 21:03:51 -0700 |
---|---|---|
committer | Evan <eroelke@gmail.com> | 2019-11-18 21:03:51 -0700 |
commit | 6fb437f9eb64e0df62a8b8ad7f28bfd92a2a986f (patch) | |
tree | 52c3213a28da277d953197be1aa1e4120bafd0c9 | |
parent | 186e17b7ebec8f5abcbcb4a7e06de5c87aa7162c (diff) |
matching rom
-rw-r--r-- | data/option_menu.s | 33 | ||||
-rw-r--r-- | data/strings.s | 30 | ||||
-rw-r--r-- | graphics/misc/unk_83cc2e4.pal | 19 | ||||
-rw-r--r-- | include/menu_helpers.h | 2 | ||||
-rw-r--r-- | include/strings.h | 14 | ||||
-rw-r--r-- | src/menu_helpers.c | 2 | ||||
-rw-r--r-- | src/option_menu.c | 130 |
7 files changed, 137 insertions, 93 deletions
diff --git a/data/option_menu.s b/data/option_menu.s index 098e76f31..f8a590d6d 100644 --- a/data/option_menu.s +++ b/data/option_menu.s @@ -1,43 +1,44 @@ #include "constants/maps.h" #include "constants/species.h" - .include "asm/macros.inc" - .include "constants/constants.inc" + .include "asm/macros.inc" + .include "constants/constants.inc" - .section .rodata - .align 2 + .section .rodata + .align 2 gUnknown_83CC2B8:: @ 83CC2B8 - .incbin "baserom.gba", 0x3CC2B8, 0x20 + .incbin "baserom.gba", 0x3CC2B8, 0x20 gUnknown_83CC2D8:: @ 83CC2D8 - .incbin "baserom.gba", 0x3CC2D8, 0xC + .incbin "baserom.gba", 0x3CC2D8, 0xC gUnknown_83CC2E4:: @ 83CC2E4 - .incbin "baserom.gba", 0x3CC2E4, 0x20 + .incbin "baserom.gba", 0x3CC2E4, 0x20 gUnknown_83CC304:: @ 83CC304 - .incbin "baserom.gba", 0x3CC304, 0x10 + .incbin "baserom.gba", 0x3CC304, 0x10 gUnknown_83CC314:: @ 83CC314 - .incbin "baserom.gba", 0x3CC314, 0x1C + .incbin "baserom.gba", 0x3CC314, 0x1C gUnknown_83CC330:: @ 83CC330 - .incbin "baserom.gba", 0x3CC330, 0xC + .incbin "baserom.gba", 0x3CC330, 0xC gUnknown_83CC33C:: @ 83CC33C - .incbin "baserom.gba", 0x3CC33C, 0x8 + .incbin "baserom.gba", 0x3CC33C, 0x8 gUnknown_83CC344:: @ 83CC344 - .incbin "baserom.gba", 0x3CC344, 0x8 + .incbin "baserom.gba", 0x3CC344, 0x8 gUnknown_83CC34C:: @ 83CC34C - .incbin "baserom.gba", 0x3CC34C, 0x8 + .incbin "baserom.gba", 0x3CC34C, 0x8 gUnknown_83CC354:: @ 83CC354 - .incbin "baserom.gba", 0x3CC354, 0xC + .incbin "baserom.gba", 0x3CC354, 0xC gUnknown_83CC360:: @ 83CC360 - .incbin "baserom.gba", 0x3CC360, 0x3 + .incbin "baserom.gba", 0x3CC360, 0x3 gUnknown_83CC363:: @ 83CC363 - .incbin "baserom.gba", 0x3CC363, 0x3 + .incbin "baserom.gba", 0x3CC363, 0x3 + diff --git a/data/strings.s b/data/strings.s index 14a4472e3..a75671090 100644 --- a/data/strings.s +++ b/data/strings.s @@ -2904,7 +2904,7 @@ gUnknown_8419D89:: @ 8419D89 .string "Waiting for the other TRAINER to\n" .string "finish reading your TRAINER CARD.$" -gUnknown_8419DCC:: @ 8419DCC +gText_MenuOptionOption:: @ 8419DCC .string "OPTION$" gText_TextSpeed:: @ 0x8419DD3 @@ -2928,49 +2928,49 @@ gText_Frame:: @ 0x8419E0A gText_OptionMenuCancel:: @ 0x8419E10 .string "CANCEL$" -gUnknown_8419E17:: @ 0x8419E17 +gText_TextSpeedSlow:: @ 0x8419E17 .string "SLOW$" -gUnknown_8419E1C:: @ 0x8419E1C +gText_TextSpeedMid:: @ 0x8419E1C .string "MID$" -gUnknown_8419E20:: @ 0x8419E20 +gText_TextSpeedFast:: @ 0x8419E20 .string "FAST$" -gUnknown_8419E25:: @ 0x8419E25 +gText_BattleSceneOn:: @ 0x8419E25 .string "ON$" -gUnknown_8419E28:: @ 0x8419E28 +gText_BattleSceneOff:: @ 0x8419E28 .string "OFF$" -gUnknown_8419E2C:: @ 0x8419E2C +gText_BattleStyleShift:: @ 0x8419E2C .string "SHIFT$" -gUnknown_8419E32:: @ 0x8419E32 +gText_BattleStyleSet:: @ 0x8419E32 .string "SET$" -gUnknown_8419E36:: @ 0x8419E36 +gText_SoundMono:: @ 0x8419E36 .string "MONO$" -gUnknown_8419E3B:: @ 0x8419E3B +gText_SoundStereo:: @ 0x8419E3B .string "STEREO$" gUnknown_8419E42:: @ 0x8419E42 .string "タイプ$" -gUnknown_8419E46:: @ 0x8419E46 +gText_ButtonTypeNormal:: @ 0x8419E46 .string "HELP$" -gUnknown_8419E4B:: @ 0x8419E4B +gText_ButtonTypeLR:: @ 0x8419E4B .string "LゅA$" -gUnknown_8419E4F:: @ 0x8419E4F +gText_ButtonTypeLEqualsA:: @ 0x8419E4F .string "LR$" -gUnknown_8419E52:: @ 8419E52 +gText_FrameType:: @ 8419E52 .string "TYPE$" -gUnknown_8419E57:: @ 8419E57 +gText_PickSwitchCancel:: @ 8419E57 .string "{DPAD_UPDOWN}PICK {DPAD_LEFTRIGHT}SWITCH {A_BUTTON}{B_BUTTON}CANCEL$" gUnknown_8419E72:: @ 0x8419E72 diff --git a/graphics/misc/unk_83cc2e4.pal b/graphics/misc/unk_83cc2e4.pal new file mode 100644 index 000000000..b2172775f --- /dev/null +++ b/graphics/misc/unk_83cc2e4.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +255 255 255 +255 255 255 +99 99 99 +214 214 206 +230 8 8 +255 189 115 +33 156 8 +148 247 148 +49 82 206 +165 197 247 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/include/menu_helpers.h b/include/menu_helpers.h index 8d042825c..6ea771500 100644 --- a/include/menu_helpers.h +++ b/include/menu_helpers.h @@ -12,7 +12,7 @@ struct YesNoFuncTable }; bool16 RunTextPrinters_CheckActive(u8 textPrinterId); -bool32 sub_80BF72C(void); +bool8 sub_80BF72C(void); bool8 sub_80BF748(void); bool8 MenuHelpers_LinkSomething(void); void SetVBlankHBlankCallbacksToNull(void); diff --git a/include/strings.h b/include/strings.h index bdef1b956..9f11d8fc2 100644 --- a/include/strings.h +++ b/include/strings.h @@ -749,6 +749,20 @@ extern const u8 gText_Sound[]; extern const u8 gText_ButtonMode[]; extern const u8 gText_Frame[]; extern const u8 gText_OptionMenuCancel[]; +extern const u8 gText_TextSpeedSlow[]; +extern const u8 gText_TextSpeedMid[]; +extern const u8 gText_TextSpeedFast[]; +extern const u8 gText_BattleSceneOn[]; +extern const u8 gText_BattleSceneOff[]; +extern const u8 gText_BattleStyleShift[]; +extern const u8 gText_BattleStyleSet[]; +extern const u8 gText_SoundMono[]; +extern const u8 gText_SoundStereo[]; +extern const u8 gText_ButtonTypeNormal[]; +extern const u8 gText_ButtonTypeLR[]; +extern const u8 gText_ButtonTypeLEqualsA[]; +extern const u8 gText_MenuOptionOption[]; +extern const u8 gText_FrameType[]; extern const u8 gText_PickSwitchCancel[]; diff --git a/src/menu_helpers.c b/src/menu_helpers.c index 027280beb..06e7bb08b 100644 --- a/src/menu_helpers.c +++ b/src/menu_helpers.c @@ -125,7 +125,7 @@ bool8 MenuHelpers_LinkSomething(void) return FALSE; } -bool32 sub_80BF72C(void) +bool8 sub_80BF72C(void) { if (!MenuHelpers_LinkSomething()) return FALSE; diff --git a/src/option_menu.c b/src/option_menu.c index c98a2ec7b..c1cde37a6 100644 --- a/src/option_menu.c +++ b/src/option_menu.c @@ -36,11 +36,10 @@ enum enum { WIN_TEXT_OPTION, - WIN_OPTIONS + WIN_OPTIONS, }; - /* -static const struct WindowTemplate gUnknown_83CC2B8[] = //sOptionMenuWinTemplates +static const struct WindowTemplate gUnknown_83CC2B8[] = //3CC2B8 -> sOptionMenuWinTemplates { { .bg = 1, @@ -49,20 +48,29 @@ static const struct WindowTemplate gUnknown_83CC2B8[] = //sOptionMenuWinTempl .width = 26, .height = 2, .paletteNum = 1, - .baseBlock = 2 + .baseBlock = 2, }, { .bg = 0, .tilemapLeft = 2, - .tilemapTop =7, + .tilemapTop = 7, .width = 26, .height = 12, .paletteNum = 1, - .baseBlock = 0x36 + .baseBlock = 0x36, }, - DUMMY_WIN_TEMPLATE + { + .bg = 2, + .tilemapLeft = 0, + .tilemapTop = 0, + .width = 30, + .height = 2, + .paletteNum = 0xF, + .baseBlock = 0x16e, + }, + DUMMY_WIN_TEMPLATE, }; -static const struct BgTemplate gUnknown_83CC2D8[] = //sOptionMenuBgTemplates +static const struct BgTemplate gUnknown_83CC2D8[] = //3CC2D8 -> sOptionMenuBgTemplates { { .bg = 1, @@ -81,12 +89,20 @@ static const struct BgTemplate gUnknown_83CC2D8[] = //sOptionMenuBgTemplates .paletteMode = 0, .priority = 1, .baseTile = 0 - } + }, + { + .bg = 2, + .charBaseIndex = 1, + .mapBaseIndex = 29, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0, + }, }; - - -static const u16 gUnknown_83CC304[MENUITEM_COUNT] = {3, 2, 2, 2, 3, 10, 0}; //sOptionsMenuItemCounts -static const u8* gUnknown_83CC314[MENUITEM_COUNT] = //sOptionMenuItemsNames +static const u16 gUnknown_83CC2E4[] = INCBIN_U16("graphics/misc/unk_83cc2e4.gbapal"); //3CC2E4 +static const u16 gUnknown_83CC304[MENUITEM_COUNT] = {3, 2, 2, 2, 3, 10, 0}; //3CC304 -> sOptionsMenuItemCounts +static const u8* gUnknown_83CC314[MENUITEM_COUNT] = //3CC314 -> sOptionMenuItemsNames { [MENUITEM_TEXTSPEED] = gText_TextSpeed, [MENUITEM_BATTLESCENE] = gText_BattleScene, @@ -96,8 +112,28 @@ static const u8* gUnknown_83CC314[MENUITEM_COUNT] = //sOptionMenuItemsNames [MENUITEM_FRAMETYPE] = gText_Frame, [MENUITEM_CANCEL] = gText_OptionMenuCancel, }; +static const u8* gUnknown_83CC330[] = {gText_TextSpeedSlow, gText_TextSpeedMid, gText_TextSpeedFast}; //3CC330 +static const u8* gUnknown_83CC33C[] = {gText_BattleSceneOn, gText_BattleSceneOff}; //3CC33C +static const u8* gUnknown_83CC344[] = {gText_BattleStyleShift, gText_BattleStyleSet}; //3CC344 +static const u8* gUnknown_83CC34C[] = {gText_SoundMono, gText_SoundStereo}; //3CC34C +static const u8* gUnknown_83CC354[] = {gText_ButtonTypeNormal, gText_ButtonTypeLR, gText_ButtonTypeLEqualsA}; //3CC354 +static const u8 gUnknown_83CC360[] = {0xF, 0x1, 0x2}; //3CC360 +static const u8 gUnknown_83CC363[] = {0, 5, 4, 0, 0}; //3CC363 */ +extern const struct WindowTemplate gUnknown_83CC2B8[3]; +extern const struct BgTemplate gUnknown_83CC2D8[3]; +extern const u16 gUnknown_83CC2E4[0x20]; +extern const u16 gUnknown_83CC304[MENUITEM_COUNT]; +extern const u8* gUnknown_83CC314[MENUITEM_COUNT]; +extern const u8* gUnknown_83CC330[12]; +extern const u8* gUnknown_83CC33C[8]; +extern const u8* gUnknown_83CC344[8]; +extern const u8* gUnknown_83CC34C[8]; +extern const u8* gUnknown_83CC354[12]; +extern const u8 gUnknown_83CC360[3]; +extern const u8 gUnknown_83CC363[3]; + //This file's functions static void sub_808835C(void); static void sub_8088374(void); @@ -118,25 +154,9 @@ static void sub_8088C0C(void); static void sub_8088D8C(void); static void sub_8088DE0(u16 selection); -extern const struct WindowTemplate gUnknown_83CC2B8[3]; -extern const struct BgTemplate gUnknown_83CC2D8[2]; -extern const u16 gUnknown_83CC2E4[0x20]; -extern const u16 gUnknown_83CC304[MENUITEM_COUNT]; //sOptionsMenuItemCounts -extern const u8* gUnknown_83CC314[MENUITEM_COUNT]; -extern const u8 gUnknown_83CC330[0xC]; -extern const u8 gUnknown_83CC33C[0x8]; -extern const u8 gUnknown_83CC344[0x8]; -extern const u8 gUnknown_83CC34C[0x8]; -extern const u8 gUnknown_83CC354[0xC]; -extern const u8 gUnknown_83CC360[0x3]; -extern const u8 gUnknown_83CC363[0x3]; -extern const u8 gUnknown_8419DCC[]; -extern const u8 gUnknown_8419E52[]; -extern const u8 gUnknown_8419E57[]; - struct OptionsMenu { - /*0x00*/ u16 option[7]; //0,2,4,6,8,a,c + /*0x00*/ u16 option[MENUITEM_COUNT]; //0,2,4,6,8,a,c /*0x0E*/ u16 unkE; /*0x10*/ u8 state3; /*0x11*/ u8 state; @@ -147,6 +167,7 @@ struct OptionsMenu EWRAM_DATA struct OptionsMenu *sOptionsMenu = {0}; + //CB2_InitOptionsMenu static void sub_808835C(void) { @@ -272,7 +293,7 @@ static void sub_8088530(void) DmaClear16(3, (void *)PLTT, PLTT_SIZE); SetGpuReg(REG_OFFSET_DISPCNT, 0); ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, gUnknown_83CC2D8, 3); //3 -> ARRAY_COUNT(gUnknown_83CC2D8) + InitBgsFromTemplates(0, gUnknown_83CC2D8, ARRAY_COUNT(gUnknown_83CC2D8)); ChangeBgX(0, 0, 0); ChangeBgY(0, 0, 0); ChangeBgX(1, 0, 0); @@ -297,9 +318,9 @@ static void sub_8088530(void) static void sub_8088680(void) { s32 x; - x = 0xE4 - GetStringWidth(0, gUnknown_8419E57, 0); + x = 0xE4 - GetStringWidth(0, gText_PickSwitchCancel, 0); FillWindowPixelBuffer(2, 0xFF); - AddTextPrinterParameterized3(2, 0, x, 0, gUnknown_83CC360, 0, gUnknown_8419E57); + AddTextPrinterParameterized3(2, 0, x, 0, gUnknown_83CC360, 0, gText_PickSwitchCancel); PutWindowTilemap(2); CopyWindowToVram(2, 3); } @@ -357,7 +378,7 @@ static void sub_8088780(u8 taskId) sOptionsMenu->state3++; break; case 2: - if (sub_80BF72C() == TRUE) + if ((bool32) sub_80BF72C() == TRUE) //cast to bool32 to remove the lsl/lsr 0x18 after func call return; switch (sub_80888C0()) { @@ -547,10 +568,8 @@ static void sub_8088780(u8 taskId) "\tpop {r0}\n" "\tbx r0\n"); } -#endif - - - +#endif + //OptionsMenu_ProcessInput static u8 sub_80888C0(void) { @@ -616,7 +635,6 @@ static void sub_80889A8(u8 selection) u8* str; u8* v8; u8 x, y; - u8** col; memcpy(&dst, gUnknown_83CC363, 3); y = ((GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT) - 1) * selection) + 2; @@ -641,7 +659,7 @@ static void sub_80889A8(u8 selection) AddTextPrinterParameterized3(1, 2, x, y, dst, -1, gUnknown_83CC354); break; case MENUITEM_FRAMETYPE: - StringCopy(str, gUnknown_8419E52); + StringCopy(str, gText_FrameType); ConvertIntToDecimalStringN(v8, sOptionsMenu->option[2*selection] + 1, 1, 2); StringAppendN(str, v8, 3); AddTextPrinterParameterized3(1, 2, x, y, dst, -1, str); @@ -773,7 +791,7 @@ static void sub_80889A8(u8 selection) "_08088A94: .4byte gUnknown_83CC354\n" "_08088A98: .4byte sOptionsMenu\n" "_08088A9C:\n" - "\tldr r1, _08088AF8 @ =gUnknown_8419E52\n" + "\tldr r1, _08088AF8 @ =gText_FrameType\n" "\tadd r0, sp, 0xC\n" "\tbl StringCopy\n" "\tadd r4, sp, 0x20\n" @@ -815,7 +833,7 @@ static void sub_80889A8(u8 selection) "\tpop {r0}\n" "\tbx r0\n" "\t.align 2, 0\n" - "_08088AF8: .4byte gUnknown_8419E52\n" + "_08088AF8: .4byte gText_FrameType\n" "_08088AFC: .4byte sOptionsMenu\n"); } #endif @@ -846,14 +864,13 @@ static void sub_8088B00(u8 taskId) static void sub_8088BD0(void) { FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParameterized(WIN_TEXT_OPTION, 2, gUnknown_8419DCC, 8, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(WIN_TEXT_OPTION, 2, gText_MenuOptionOption, 8, 1, TEXT_SPEED_FF, NULL); PutWindowTilemap(0); CopyWindowToVram(0, 3); } //sub_8088C0C -//double check static void sub_8088C0C(void) { u8 h; @@ -863,7 +880,7 @@ static void sub_8088C0C(void) FillBgTilemapBufferRect(1, 0x1B4, 2, 2, 0x1B, 1, 3); FillBgTilemapBufferRect(1, 0x1B5, 0x1C, 2, 1, 1, 3); FillBgTilemapBufferRect(1, 0x1B6, 1, 3, 1, h, 3); - FillBgTilemapBufferRect(1, 0x1B8, 1, 0x1C, 1, h, 3); + FillBgTilemapBufferRect(1, 0x1B8, 0x1C, 3, 1, h, 3); FillBgTilemapBufferRect(1, 0x1B9, 1, 5, 1, 1, 3); FillBgTilemapBufferRect(1, 0x1BA, 2, 5, 0x1B, 1, 3); FillBgTilemapBufferRect(1, 0x1BB, 0x1C, 5, 1, 1, 3); @@ -878,24 +895,15 @@ static void sub_8088C0C(void) CopyBgTilemapBufferToVram(1); } - //sub_8088D8C static void sub_8088D8C(void) { - int i; - u8 y; + u8 i; FillWindowPixelBuffer(1, 0x11); - for (i = 0; i < MENUITEM_COUNT; i++) { - //AddTextPrinterParameterized(1, 2, gUnknown_83CC314[i], 8, (u8) ((i*(GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT))) + 2) - i, 0xFF, 0); - //gets registers right, but an lsl/lsr 0x18 after GetFontAttribute that shouldn't be there - y = i*(GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT)); - y += 2; - y -= i; - AddTextPrinterParameterized(1, 2, gUnknown_83CC314[i], 8, y, 0xFF, 0); - + AddTextPrinterParameterized(1, 2, gUnknown_83CC314[i], 8, (u8) ((i*(GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT))) + 2) - i, 0xFF, 0); } } @@ -903,9 +911,11 @@ static void sub_8088D8C(void) //sub_8088DE0 static void sub_8088DE0(u16 selection) { - u8 attr; - attr = GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT); - SetGpuReg(0x44, ((selection * (attr - 1) + 58) << 8) | (selection * (attr - 1) + 58 + attr)); - SetGpuReg(0x40, 4320); + u16 v1, v2; + + v1 = GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT); + v2 = selection * (v1 - 1) + 0x3A; + SetGpuReg(0x44, (v2 << 8) | (v2 + v1)); + SetGpuReg(0x40, 0x10E0); } |