From a4e2ce163bb3957bd3e5e28e828703412ee95ede Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 7 Jun 2023 02:48:21 +0100 Subject: [PATCH] use enums for strings --- arm9/modules/59/include/mod59_Intro.h | 2 +- arm9/modules/59/src/mod59_Intro.c | 119 +++++++++++++------------- arm9/modules/59/src/mod59_TV.c | 23 ++--- arm9/src/bag_view.c | 24 +++--- arm9/src/communication_error.c | 11 +-- arm9/src/error_message_reset.c | 4 +- arm9/src/itemtool.c | 6 +- arm9/src/message_format.c | 13 +-- arm9/src/msgdata.c | 5 +- arm9/src/save_data_read_error.c | 5 +- arm9/src/save_data_write_error.c | 5 +- arm9/src/wfc_user_info_warning.c | 39 +++++---- 12 files changed, 135 insertions(+), 121 deletions(-) diff --git a/arm9/modules/59/include/mod59_Intro.h b/arm9/modules/59/include/mod59_Intro.h index 4bc2d5ab0..d5b62c0d5 100644 --- a/arm9/modules/59/include/mod59_Intro.h +++ b/arm9/modules/59/include/mod59_Intro.h @@ -115,7 +115,7 @@ void MOD59_021D7A5C(MOD59_IntroOverlayData *data); BOOL MOD59_FadeController(MOD59_IntroOverlayData *data, u32 param1, u32 param2); BOOL MOD59_Timer(MOD59_IntroOverlayData *data, s32 timer); void MOD59_TilemapChangePalette(MOD59_IntroOverlayData *data, u32 layer, u32 paletteNum); -BOOL MOD59_DisplayMessage(MOD59_IntroOverlayData *data, u32 msgNo, u32 param2); +BOOL MOD59_DisplayMessage(MOD59_IntroOverlayData *data, u32 msgNo, BOOL autoAdvance); void MOD59_PlaySelectSound(struct ListMenu *list, s32 index, u8 onInit); BOOL MOD59_CreateListWithText(MOD59_IntroOverlayData *data, u32 param1, u32 param2); BOOL MOD59_DisplayControlAdventureMessage(MOD59_IntroOverlayData *data, u32 msgNo, u32 param2, u32 tilemapTop, u32 height); diff --git a/arm9/modules/59/src/mod59_Intro.c b/arm9/modules/59/src/mod59_Intro.c index 3e5708eec..942b3938c 100644 --- a/arm9/modules/59/src/mod59_Intro.c +++ b/arm9/modules/59/src/mod59_Intro.c @@ -15,6 +15,7 @@ #include "module_52.h" #include "msgdata.h" #include "msgdata/msg.naix" +#include "msgdata/msg/narc_0341.h" #include "overlay_manager.h" #include "player_data.h" #include "pokemon.h" @@ -126,11 +127,11 @@ const struct MOD59_CharStruct021D9DEC MOD59_021D9DFC = const struct MOD59_ListStruct021D9E0C MOD59_021D9E0C[2] = { { - .msgNo = 34, + .msgNo = narc_0341_00034, //YES .val = 1 }, { - .msgNo = 35, + .msgNo = narc_0341_00035, //NO .val = 2 } }; @@ -150,15 +151,15 @@ const u32 MOD59_021D9E44[5] = { 0, 6, 1, 12, 2060 }; const struct MOD59_ListStruct021D9E0C MOD59_021D9E58[3] = { { - .msgNo = 31, + .msgNo = narc_0341_00031, //CONTROL INFO .val = 1 }, { - .msgNo = 32, + .msgNo = narc_0341_00032, //ADVENTURE INFO .val = 2 }, { - .msgNo = 33, + .msgNo = narc_0341_00033, //NO INFO NEEDED .val = 3 } }; @@ -237,23 +238,23 @@ const struct ListMenuTemplate MOD59_021D9EF8 = const struct MOD59_ListStruct021D9E0C MOD59_021D9F40[5] = { { - .msgNo = 36, + .msgNo = narc_0341_00036, //New name! .val = 1 }, { - .msgNo = 37, + .msgNo = narc_0341_00037, //Barry .val = 2 }, { - .msgNo = 38, + .msgNo = narc_0341_00038, //Damion .val = 3 }, { - .msgNo = 39, + .msgNo = narc_0341_00039, //Tyson .val = 4 }, { - .msgNo = 40, + .msgNo = narc_0341_00040, //Markus .val = 5 } }; @@ -261,39 +262,39 @@ const struct MOD59_ListStruct021D9E0C MOD59_021D9F40[5] = const struct MOD59_ListStruct021D9E0C MOD59_021D9F68[5] = { { - .msgNo = 36, + .msgNo = narc_0341_00036, //New name! .val = 1 }, { - .msgNo = 41, + .msgNo = narc_0341_00041, //Clint .val = 2 }, { - .msgNo = 42, + .msgNo = narc_0341_00042, //Ralph .val = 3 }, { - .msgNo = 43, + .msgNo = narc_0341_00043, //Lewis .val = 4 }, { - .msgNo = 44, + .msgNo = narc_0341_00044, //Tommy .val = 5 } }; const struct GraphicsBanks MOD59_021D9F18 = { - .bg = 2, - .bgextpltt = 0, - .subbg = 4, - .subbgextpltt = 0, - .obj = 0, - .objextpltt = 0, - .subobj = 0, - .subobjextpltt = 0, - .tex = 0, - .texpltt = 0 + .bg = GX_VRAM_BG_128_B, + .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, + .subbg = GX_VRAM_SUB_BG_128_C, + .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, + .obj = GX_VRAM_OBJ_NONE, + .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, + .subobj = GX_VRAM_SUB_OBJ_NONE, + .subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE, + .tex = GX_VRAM_TEX_NONE, + .texpltt = GX_VRAM_TEXPLTT_NONE }; const struct MOD59_GraphicsPaletteMap021D9F90 MOD59_021D9F90 = @@ -815,7 +816,7 @@ THUMB_FUNC void MOD59_TilemapChangePalette(MOD59_IntroOverlayData *data, u32 lay BgCommitTilemapBufferToVram(data->bgConfig, (u8)layer); } -THUMB_FUNC BOOL MOD59_DisplayMessage(MOD59_IntroOverlayData *data, u32 msgNo, u32 param2) +THUMB_FUNC BOOL MOD59_DisplayMessage(MOD59_IntroOverlayData *data, u32 msgNo, BOOL autoAdvance) { BOOL ret = FALSE; switch(data->displayMessageCounter) @@ -849,7 +850,7 @@ THUMB_FUNC BOOL MOD59_DisplayMessage(MOD59_IntroOverlayData *data, u32 msgNo, u3 data->displayMessageCounter = 2; break; case 2: - if (param2 != 0 || (gSystem.newKeys & PAD_BUTTON_A) == 1) + if (autoAdvance != FALSE || (gSystem.newKeys & PAD_BUTTON_A) == 1) { RemoveWindow(&data->window); data->displayMessageCounter = 0; @@ -1876,7 +1877,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 2: //Hello there! It’s so very nice to meet you! - if(MOD59_DisplayMessage(data, 0, 1) != TRUE) + if(MOD59_DisplayMessage(data, narc_0341_00000, TRUE) != TRUE) { break; } @@ -1904,7 +1905,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 5: //My name is Rowan. However, everyone just calls me the Pokémon Professor. - if (MOD59_DisplayMessage(data, 1, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00001, TRUE) != TRUE) { break; } @@ -1976,7 +1977,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 12: //Moves the main character. Also used to choose various headings and selections. - if (MOD59_DisplayControlAdventureMessage(data, 2, 0, 3, 18) != TRUE) + if (MOD59_DisplayControlAdventureMessage(data, narc_0341_00002, 0, 3, 18) != TRUE) { break; } @@ -1990,7 +1991,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 14: //Press to open the menu. Press to use an item, - if (MOD59_DisplayControlAdventureMessage(data, 3, 0, 7, 12) != TRUE) + if (MOD59_DisplayControlAdventureMessage(data, narc_0341_00003, 0, 7, 12) != TRUE) { break; } @@ -2004,7 +2005,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 16: //The lower screen is called the Touch Screen. - if (MOD59_DisplayControlAdventureMessage(data, 4, 0, 4, 12) != TRUE) + if (MOD59_DisplayControlAdventureMessage(data, narc_0341_00004, 0, 4, 12) != TRUE) { break; } @@ -2012,7 +2013,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 17: //Use DisplayMessage to create the flashing touchscreen icon ({YESNO 0}) - if (MOD59_DisplayMessage(data, 6, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00006, TRUE) != TRUE) { break; } @@ -2020,7 +2021,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 18: //If this mark is shown in the message window - if (MOD59_DisplayControlAdventureMessage(data, 5, 0, 4, 10) != TRUE) + if (MOD59_DisplayControlAdventureMessage(data, narc_0341_00005, 0, 4, 10) != TRUE) { break; } @@ -2034,7 +2035,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 20: //Do you understand everything so far?{YESNO 0} - if (MOD59_DisplayMessage(data, 7, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00007, TRUE) != TRUE) { break; } @@ -2123,7 +2124,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 27: //Please touch a button on the Touch Screen below.{YESNO 0} - if (MOD59_DisplayMessage(data, 8, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00008, TRUE) != TRUE) { break; } @@ -2150,7 +2151,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 30: //Would you like to know more about anything else? - if (MOD59_DisplayMessage(data, 9, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00009, TRUE) != TRUE) { break; } @@ -2175,7 +2176,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 33: - if (MOD59_DisplayControlAdventureMessage(data, 10, 1, 9, 6) != TRUE) + if (MOD59_DisplayControlAdventureMessage(data, narc_0341_00010, 1, 9, 6) != TRUE) { break; } @@ -2183,7 +2184,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 34: - if (MOD59_DisplayControlAdventureMessage(data, 11, 1, 8, 8) != TRUE) + if (MOD59_DisplayControlAdventureMessage(data, narc_0341_00011, 1, 8, 8) != TRUE) { break; } @@ -2191,7 +2192,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 35: - if (MOD59_DisplayControlAdventureMessage(data, 12, 1, 9, 6) != TRUE) + if (MOD59_DisplayControlAdventureMessage(data, narc_0341_00012, 1, 9, 6) != TRUE) { break; } @@ -2199,7 +2200,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 36: - if (MOD59_DisplayControlAdventureMessage(data, 13, 1, 5, 14) != TRUE) + if (MOD59_DisplayControlAdventureMessage(data, narc_0341_00013, 1, 5, 14) != TRUE) { break; } @@ -2207,7 +2208,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 37: - if (MOD59_DisplayControlAdventureMessage(data, 14, 1, 10, 4) != TRUE) + if (MOD59_DisplayControlAdventureMessage(data, narc_0341_00014, 1, 10, 4) != TRUE) { break; } @@ -2215,7 +2216,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 38: - if (MOD59_DisplayControlAdventureMessage(data, 15, 1, 6, 12) != TRUE) + if (MOD59_DisplayControlAdventureMessage(data, narc_0341_00015, 1, 6, 12) != TRUE) { break; } @@ -2246,7 +2247,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 42: //This world is widely inhabited by creatures known as Pokémon. - if (MOD59_DisplayMessage(data, 16, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00016, TRUE) != TRUE) { break; } @@ -2280,7 +2281,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 46:// Here, I have a Poké Ball. Touch the button on the middle - if (MOD59_DisplayMessage(data, 17, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00017, TRUE) != TRUE) { break; } @@ -2335,7 +2336,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 49: //No, no! Not that button! The button on the Poké Ball.{YESNO 0} - if (MOD59_DisplayMessage(data, 18, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00018, TRUE) != TRUE) { break; } @@ -2414,7 +2415,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 58: // We humans live alongside Pokémon as friends. At times we play together, - if (MOD59_DisplayMessage(data, 19, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00019, TRUE) != TRUE) { break; } @@ -2440,7 +2441,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 61: //Now, why don’t you tell me a little bit about yourself? - if (MOD59_DisplayMessage(data, 20, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00020, TRUE) != TRUE) { break; } @@ -2482,7 +2483,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 66: //Are you a boy? Or are you a girl? - if (MOD59_DisplayMessage(data, 21, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00021, TRUE) != TRUE) { break; } @@ -2549,8 +2550,8 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 72: //All right, so you’re a boy/girl? - u32 msgNo = data->selectedGender == Male ? 22 : 23; - if (MOD59_DisplayMessage(data, msgNo, 1) != TRUE) + u32 msgNo = data->selectedGender == Male ? narc_0341_00022 : narc_0341_00023; + if (MOD59_DisplayMessage(data, msgNo, TRUE) != TRUE) { break; } @@ -2586,7 +2587,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 75: //Tell me, what is your name? - if (MOD59_DisplayMessage(data, 24, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00024, TRUE) != TRUE) { break; } @@ -2626,8 +2627,8 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 79: //Your name is {STRVAR_1 3, 0}? - u32 messageNumber = (data->selectedGender == Male ? 25 : 26); //no idea why these are different strings, they contain the same thing - if (MOD59_DisplayMessage(data, messageNumber, 1) != TRUE) + u32 messageNumber = (data->selectedGender == Male ? narc_0341_00025 : narc_0341_00026); //no idea why these are different strings, they contain the same thing + if (MOD59_DisplayMessage(data, messageNumber, TRUE) != TRUE) { break; } @@ -2681,7 +2682,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 84: // OK... So, you’re {STRVAR_1 3, 0}? A fine name that is! - if (MOD59_DisplayMessage(data, 27, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00027, TRUE) != TRUE) { break; } @@ -2712,7 +2713,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 88: //What might his name be? - if (MOD59_DisplayMessage(data, 28, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00028, TRUE) != TRUE) { break; } @@ -2800,7 +2801,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 95: //{STRVAR_1 3, 1}, is it? That’s your friend’s name? - if (MOD59_DisplayMessage(data, 29, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00029, TRUE) != TRUE) { break; } @@ -2859,7 +2860,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) break; case 101: //All right, {STRVAR_1 3, 0}, the time has come. Your very own tale of grand... - if (MOD59_DisplayMessage(data, 30, 1) != TRUE) + if (MOD59_DisplayMessage(data, narc_0341_00030, TRUE) != TRUE) { break; } @@ -2925,7 +2926,7 @@ THUMB_FUNC BOOL MOD59_MasterController(MOD59_IntroOverlayData *data) data->controllerCounter = 108; break; - case 108: //load overaly 59 pt 2 + case 108: //load overaly 59 TV data->loadedOverlay = OverlayManager_New(&MOD59_021D9DDC, 0, data->heap_id); data->controllerCounter = 109; break; diff --git a/arm9/modules/59/src/mod59_TV.c b/arm9/modules/59/src/mod59_TV.c index 2c4f79f6f..0fa821612 100644 --- a/arm9/modules/59/src/mod59_TV.c +++ b/arm9/modules/59/src/mod59_TV.c @@ -10,6 +10,7 @@ #include "gf_gfx_loader.h" #include "heap.h" #include "msgdata/msg.naix" +#include "msgdata/msg/narc_0549.h" #include "overlay_manager.h" #include "text.h" #include "unk_020040F4.h" @@ -112,16 +113,16 @@ const struct BgTemplate MOD59_021DA0B8 = const struct GraphicsBanks MOD59_021DA0D4 = { - .bg = 3, - .bgextpltt = 0, - .subbg = 0, - .subbgextpltt = 0, - .obj = 0, - .objextpltt = 0, - .subobj = 0, - .subobjextpltt = 0, - .tex = 0, - .texpltt = 0 + .bg = GX_VRAM_BG_256_AB, + .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, + .subbg = GX_VRAM_SUB_BG_NONE, + .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, + .obj = GX_VRAM_OBJ_NONE, + .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, + .subobj = GX_VRAM_SUB_OBJ_NONE, + .subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE, + .tex = GX_VRAM_TEX_NONE, + .texpltt = GX_VRAM_TEXPLTT_NONE }; THUMB_FUNC BOOL MOD59_TVInit(struct OverlayManager *overlayManager, u32 *status) @@ -212,7 +213,7 @@ THUMB_FUNC BOOL MOD59_TVMain(struct OverlayManager *overlayManager, u32 *status) case 4: MOD59_021D9D78(data); - if (MOD59_021D9C74(data, 0, 40, 48) != TRUE) + if (MOD59_021D9C74(data, narc_0549_00000, 40, 48) != TRUE) { break; } diff --git a/arm9/src/bag_view.c b/arm9/src/bag_view.c index c9187a1d2..beecfbbb7 100644 --- a/arm9/src/bag_view.c +++ b/arm9/src/bag_view.c @@ -8,6 +8,8 @@ #include "message_format.h" #include "msgdata.h" #include "msgdata/msg.naix" +#include "msgdata/msg/narc_0007.h" +#include "msgdata/msg/narc_0199.h" #include "player_data.h" #include "seal.h" #include "unk_0202A1E0.h" @@ -139,30 +141,30 @@ THUMB_FUNC BOOL TryFormatRegisteredKeyItemUseMessage(struct SaveBlock2 *sav2, st if (item_id == ITEM_NONE) { - string = NewString_ReadMsgData(msgData, 0x63); + string = NewString_ReadMsgData(msgData, narc_0007_00099); // A Key Item in the Bag can be assigned to this button for instant use. } else if (item_id == ITEM_POINT_CARD) { - string = NewString_ReadMsgData(msgData, 0x61); + string = NewString_ReadMsgData(msgData, narc_0007_00097); // Saved Battle Points {STRVAR_1 53, 0}BP BufferIntegerAsString(messageFormat, 0, FUN_0206E3E8(sav2), 4, PRINTING_MODE_LEFT_ALIGN, TRUE); } else if (item_id == ITEM_SEAL_CASE) { - string = NewString_ReadMsgData(msgData, 0x5C); + string = NewString_ReadMsgData(msgData, narc_0007_00092); // Seals: {STRVAR_1 53, 0} BufferIntegerAsString(messageFormat, 0, GetSealCount(sav2), 4, PRINTING_MODE_LEFT_ALIGN, TRUE); } else if (item_id == ITEM_FASHION_CASE) { - string = NewString_ReadMsgData(msgData, 0x5D); + string = NewString_ReadMsgData(msgData, narc_0007_00093); // Accessories: {STRVAR_1 52, 0} Backdrops: {STRVAR_1 51, 1} BufferIntegerAsString(messageFormat, 0, FUN_0206E3C8(sav2), 3, PRINTING_MODE_LEFT_ALIGN, TRUE); BufferIntegerAsString(messageFormat, 1, FUN_0206E3D8(sav2), 2, PRINTING_MODE_LEFT_ALIGN, TRUE); } else if (item_id == ITEM_COIN_CASE) { - string = NewString_ReadMsgData(msgData, 0x39); + string = NewString_ReadMsgData(msgData, narc_0007_00057); // Your Coins: {STRVAR_1 54, 0} BufferIntegerAsString(messageFormat, 0, GetCoinCount(sav2), 5, PRINTING_MODE_LEFT_ALIGN, TRUE); } @@ -191,21 +193,21 @@ THUMB_FUNC void FUN_0206E51C( //todo: sync with HG switch (r3) { case 1: - msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, 7, heap_id); + msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0007_bin, heap_id); - ReadMsgDataIntoString(msgData, 0x38, dest); + ReadMsgDataIntoString(msgData, narc_0007_00056, dest); // You can’t dismount your Bike here. DestroyMsgData(msgData); return; case 2: - msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, 7, heap_id); + msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0007_bin, heap_id); - ReadMsgDataIntoString(msgData, 0x6F, dest); + ReadMsgDataIntoString(msgData, narc_0007_00111, dest); // It can’t be used when you have someone with you. DestroyMsgData(msgData); return; default: - msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, 0xC7, heap_id); + msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0199_bin, heap_id); MessageFormat *messageFormat = MessageFormat_New(heap_id); - struct String *src = NewString_ReadMsgData(msgData, 0x24); + struct String *src = NewString_ReadMsgData(msgData, narc_0199_00036); // Rowan’s words echoed... {STRVAR_1 3, 0}! There’s a time and place for everything! But not now. BufferPlayersName(messageFormat, 0, playerData); StringExpandPlaceholders(messageFormat, dest, src); diff --git a/arm9/src/communication_error.c b/arm9/src/communication_error.c index fda95bc25..8480d8fab 100644 --- a/arm9/src/communication_error.c +++ b/arm9/src/communication_error.c @@ -5,6 +5,7 @@ #include "MI_dma.h" #include "msgdata.h" #include "msgdata/msg.naix" +#include "msgdata/msg/narc_0200.h" #include "text.h" #include "brightness.h" #include "render_window.h" @@ -75,19 +76,19 @@ THUMB_FUNC void ShowCommunicationError(u32 heap_id, u32 error, u32 error_code) { default: case 0: - error_message_no = 1; + error_message_no = narc_0200_00001; //A communication error has occurred. If you were in the Union Room... break; case 1: - error_message_no = 2; + error_message_no = narc_0200_00002; //An error occurred while attempting to communicate. ({STRVAR_1 54, 0}) Please turn off the power... break; case 2: - error_message_no = 3; + error_message_no = narc_0200_00003; //A communication error has occurred. You will be returned to the title screen... break; case 3: - error_message_no = 4; + error_message_no = narc_0200_00004; //The GTS is extremely busy now. Please wait a while and try again. break; case 4: - error_message_no = 5; + error_message_no = narc_0200_00005; //An error occurred while attempting\nto communicate.\nPlease turn off the power... break; } diff --git a/arm9/src/error_message_reset.c b/arm9/src/error_message_reset.c index f833630e3..e7c4070cf 100644 --- a/arm9/src/error_message_reset.c +++ b/arm9/src/error_message_reset.c @@ -9,7 +9,7 @@ #include "brightness.h" #include "render_window.h" #include "msgdata/msg.naix" - +#include "msgdata/msg/narc_0200.h" static const struct WindowTemplate sErrorMessageWindowTemplate = { .bgId = GF_BG_LYR_MAIN_0, @@ -134,7 +134,7 @@ THUMB_FUNC void PrintErrorMessageAndReset() FillWindowPixelRect(&buf, 15, 0, 0, 0xd0, 0x90); DrawFrameAndWindow1(&buf, FALSE, 0x1f7, 2); - ReadMsgDataIntoString(msg_data, 3, str); //todo: msgenc needs to be updated to use the constant + ReadMsgDataIntoString(msg_data, narc_0200_00003, str); //A communication error has occurred. You will be returned to the title screen... AddTextPrinterParameterized(&buf, 0, str, 0, 0, 0, NULL); diff --git a/arm9/src/itemtool.c b/arm9/src/itemtool.c index c371c7121..545fa5d43 100644 --- a/arm9/src/itemtool.c +++ b/arm9/src/itemtool.c @@ -1,6 +1,7 @@ #include "global.h" #include "itemtool.h" #include "msgdata.h" +#include "msgdata/msg.naix" #include "heap.h" #include "constants/moves.h" @@ -191,6 +192,7 @@ static const u16 sTMHMMoves[] = { MOVE_ROCK_CLIMB, }; +//TODO: use narc constants static const u16 sItemIndexMappings[][4] = { /* Col 1: Offset in item_data.narc * Col 2: Gfx offset in item_icon.narc @@ -761,14 +763,14 @@ void * LoadItemDataOrGfx(u16 a0, u16 a1, u32 heap_id) void GetItemNameIntoString(struct String * dest, u16 item_id, u32 heap_no) { - struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, 344, heap_no); + struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0344_bin, heap_no); ReadMsgDataIntoString(msgData, item_id, dest); DestroyMsgData(msgData); } void GetItemDescIntoString(struct String * dest, u16 item_id, u32 heap_no) { - struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, 343, heap_no); + struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0343_bin, heap_no); ReadMsgDataIntoString(msgData, item_id, dest); DestroyMsgData(msgData); } diff --git a/arm9/src/message_format.c b/arm9/src/message_format.c index c2494aa8c..1b4c6400d 100644 --- a/arm9/src/message_format.c +++ b/arm9/src/message_format.c @@ -5,6 +5,9 @@ #include "message_format.h" #include "msgdata.h" #include "msgdata/msg.naix" +#include "msgdata/msg/narc_0199.h" +#include "msgdata/msg/narc_0382.h" +#include "msgdata/msg/narc_0497.h" #include "player_data.h" #include "pokemon.h" #include "pokemon_storage_system.h" @@ -140,11 +143,11 @@ void BufferFriendsName(MessageFormat *messageFormat, u32 idx, struct SaveBlock2 struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0497_bin, messageFormat->heap_id); if (PlayerProfile_GetTrainerGender(data) == Male) { - ReadMsgDataIntoString(msgData, 1, messageFormat->buffer); + ReadMsgDataIntoString(msgData, narc_0497_00001, messageFormat->buffer); //Dawn } else { - ReadMsgDataIntoString(msgData, 0, messageFormat->buffer); + ReadMsgDataIntoString(msgData, narc_0497_00000, messageFormat->buffer); //Lucas } SetStringAsPlaceholder(messageFormat, idx, messageFormat->buffer, NULL); DestroyMsgData(msgData); @@ -517,10 +520,10 @@ void BufferGenderSymbol(MessageFormat *messageFormat, u32 idx, u32 gender) switch (gender) { case 0: - ReadMsgDataIntoString(msgData, 68, messageFormat->buffer); + ReadMsgDataIntoString(msgData, narc_0199_00068, messageFormat->buffer); // ♂ break; case 1: - ReadMsgDataIntoString(msgData, 69, messageFormat->buffer); + ReadMsgDataIntoString(msgData, narc_0199_00069, messageFormat->buffer); // ♀ break; default: StringSetEmpty(messageFormat->buffer); @@ -632,7 +635,7 @@ void BufferLocationName(MessageFormat *messageFormat, u32 idx, u16 location) msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0382_bin, messageFormat->heap_id); if (msgData != NULL) { - ReadMsgDataIntoString(msgData, 0, messageFormat->buffer); + ReadMsgDataIntoString(msgData, narc_0382_00000, messageFormat->buffer); // Mystery Zone SetStringAsPlaceholder(messageFormat, idx, messageFormat->buffer, NULL); DestroyMsgData(msgData); } diff --git a/arm9/src/msgdata.c b/arm9/src/msgdata.c index 6a6a5f265..10f1a6cd8 100644 --- a/arm9/src/msgdata.c +++ b/arm9/src/msgdata.c @@ -1,6 +1,7 @@ #include "global.h" #include "filesystem.h" #include "msgdata.h" +#include "msgdata/msg.naix" #include "heap.h" #include "MI_memory.h" #include "string16.h" @@ -370,7 +371,7 @@ struct String * ReadMsgData_ExpandPlaceholders(MessageFormat *messageFormat, str struct String * GetMoveName(u32 move, u32 heapno) { - struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, 588, heapno); + struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0588_bin, heapno); struct String * ret; if (msgData != NULL) { @@ -388,7 +389,7 @@ struct String * GetMoveName(u32 move, u32 heapno) struct String * GetSpeciesName(u16 species, u32 heap_id) { struct String * ret; - struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, 362, heap_id); + struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0362_bin, heap_id); if (msgData != NULL) { ret = NewString_ReadMsgData(msgData, species); diff --git a/arm9/src/save_data_read_error.c b/arm9/src/save_data_read_error.c index b4192b571..4c2dd2409 100644 --- a/arm9/src/save_data_read_error.c +++ b/arm9/src/save_data_read_error.c @@ -5,6 +5,7 @@ #include "game_init.h" #include "msgdata.h" #include "msgdata/msg.naix" +#include "msgdata/msg/narc_0005.h" #include "save_data_read_error.h" #include "text.h" #include "render_window.h" @@ -105,7 +106,7 @@ THUMB_FUNC void ShowSaveDataReadError(u32 heap_id) FillWindowPixelRect(&window, 0xF, 0, 0, 208, 144); DrawFrameAndWindow1(&window, FALSE, 0x01F7, 2); - ReadMsgDataIntoString(msg_data, 0, str); + ReadMsgDataIntoString(msg_data, narc_0005_00000, str); // The data could not be read. Please turn off the power... AddTextPrinterParameterized(&window, 0, str, 0, 0, 0, NULL); String_Delete(str); @@ -168,7 +169,7 @@ THUMB_FUNC void ShowGBACartRemovedError(u32 heap_id) FillWindowPixelRect(&window, 0xF, 0, 0, 208, 144); DrawFrameAndWindow1(&window, FALSE, 0x01F7, 2); - ReadMsgDataIntoString(msg_data, 1, str); + ReadMsgDataIntoString(msg_data, narc_0005_00001, str); // Error reading data. The GBA Game Pak was removed... AddTextPrinterParameterized(&window, 0, str, 0, 0, 0, NULL); String_Delete(str); diff --git a/arm9/src/save_data_write_error.c b/arm9/src/save_data_write_error.c index b99e79bfe..0599e3e20 100644 --- a/arm9/src/save_data_write_error.c +++ b/arm9/src/save_data_write_error.c @@ -5,6 +5,7 @@ #include "game_init.h" #include "msgdata.h" #include "msgdata/msg.naix" +#include "msgdata/msg/narc_0006.h" #include "save_data_write_error.h" #include "text.h" #include "render_window.h" @@ -64,9 +65,9 @@ THUMB_FUNC void ShowSaveDataWriteError(u32 heap_id, u32 err_no) u32 msg_no; if (err_no == 0) { - msg_no = 1; + msg_no = narc_0006_00001; // Error saving data. The backup memory has failed... } else { - msg_no = 0; + msg_no = narc_0006_00000; // The data could not be written. Please turn off the power... } FUN_0200E3A0(PM_LCD_TOP, 0); diff --git a/arm9/src/wfc_user_info_warning.c b/arm9/src/wfc_user_info_warning.c index 64303b211..4ed11613b 100644 --- a/arm9/src/wfc_user_info_warning.c +++ b/arm9/src/wfc_user_info_warning.c @@ -7,6 +7,7 @@ #include "main.h" #include "msgdata.h" #include "msgdata/msg.naix" +#include "msgdata/msg/narc_0613.h" #include "PAD_pad.h" #include "string16.h" #include "text.h" @@ -51,16 +52,16 @@ static const struct BgTemplate sWFCWarningMsgBgTemplate = { }; static const struct GraphicsBanks sWFCWarningMsgGraphicsBanks = { - .bg = 3, - .bgextpltt = 0, - .subbg = 0, - .subbgextpltt = 0, - .obj = 0, - .objextpltt = 0, - .subobj = 0, - .subobjextpltt = 0, - .tex = 0, - .texpltt = 0, + .bg = GX_VRAM_BG_256_AB, + .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, + .subbg = GX_VRAM_SUB_BG_NONE, + .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, + .obj = GX_VRAM_OBJ_NONE, + .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, + .subobj = GX_VRAM_SUB_OBJ_NONE, + .subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE, + .tex = GX_VRAM_TEX_NONE, + .texpltt = GX_VRAM_TEXPLTT_NONE, }; THUMB_FUNC void ShowWFCUserInfoWarning(u32 heap_id, u32 a1) @@ -77,18 +78,18 @@ THUMB_FUNC void ShowWFCUserInfoWarning(u32 heap_id, u32 a1) GX_DisableEngineALayers(); GX_DisableEngineBLayers(); - reg_GX_DISPCNT &= ~REG_GX_DISPCNT_DISPLAY_MASK; - reg_GXS_DB_DISPCNT &= ~REG_GX_DISPCNT_DISPLAY_MASK; + GX_SetVisiblePlane(0); + GXS_SetVisiblePlane(0); SetKeyRepeatTimers(4, 8); gSystem.screensFlipped = 0; GX_SwapDisplay(); - reg_G2_BLDCNT = 0; - reg_G2S_DB_BLDCNT = 0; - reg_GX_DISPCNT &= ~(REG_GX_DISPCNT_OW_MASK | REG_GX_DISPCNT_W1_MASK | REG_GX_DISPCNT_W0_MASK); - reg_GXS_DB_DISPCNT &= ~(REG_GXS_DB_DISPCNT_OW_MASK | REG_GXS_DB_DISPCNT_W1_MASK | REG_GXS_DB_DISPCNT_W0_MASK); + G2_BlendNone(); + G2S_BlendNone(); + GX_SetVisibleWnd(0); + GXS_SetVisibleWnd(0); GX_SetBanks(&sWFCWarningMsgGraphicsBanks); struct BgConfig* bg_config = BgConfig_Alloc(heap_id); @@ -100,8 +101,8 @@ THUMB_FUNC void ShowWFCUserInfoWarning(u32 heap_id, u32 a1) LoadUserFrameGfx1(bg_config, GF_BG_LYR_MAIN_0, 0x01F7, 2, 0, heap_id); LoadFontPal0(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_1, heap_id); BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, heap_id); - BG_SetMaskColor(GF_BG_LYR_MAIN_0, 0x6C21); - BG_SetMaskColor(GF_BG_LYR_SUB_0, 0x6C21); + BG_SetMaskColor(GF_BG_LYR_MAIN_0, GX_RGB(1, 1, 27)); + BG_SetMaskColor(GF_BG_LYR_SUB_0, GX_RGB(1, 1, 27)); struct MsgData* warning_messages_data = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0613_bin, heap_id); struct String* warning_message = String_New(384, heap_id); @@ -110,7 +111,7 @@ THUMB_FUNC void ShowWFCUserInfoWarning(u32 heap_id, u32 a1) FillWindowPixelRect(&window, 0xF, 0, 0, 208, 144); DrawFrameAndWindow1(&window, FALSE, 0x01F7, 2); - ReadMsgDataIntoString(warning_messages_data, 15, warning_message); + ReadMsgDataIntoString(warning_messages_data, narc_0613_00015, warning_message); // Your Nintendo Wi-Fi Connection User Information may have been erased... AddTextPrinterParameterized(&window, 0, warning_message, 0, 0, 0, 0); String_Delete(warning_message);