From 703ab31a243242207e535e8c2478526292dc737c Mon Sep 17 00:00:00 2001 From: red031000 Date: Thu, 29 Jun 2023 21:21:22 +0100 Subject: [PATCH 1/7] forme -> form --- arm9/asm/NNS_G2D_g2d_renderer.s | 34 +-- arm9/asm/unk_02038C78.s | 6 +- arm9/asm/unk_0206F3FC.s | 4 +- arm9/asm/unk_02073DA8.s | 4 +- arm9/global.inc | 28 +-- arm9/overlays/11/asm/ov11_02232264.s | 4 +- arm9/overlays/14/asm/overlay_14.s | 4 +- arm9/overlays/16/asm/overlay_16.s | 16 +- arm9/overlays/84/asm/overlay_84_thumb2.s | 4 +- arm9/src/hall_of_fame.c | 4 +- arm9/src/mail.c | 8 +- arm9/src/pokedex.c | 100 ++++----- arm9/src/pokemon.c | 254 +++++++++++------------ arm9/src/poketch.c | 8 +- arm9/src/scrcmd.c | 18 +- arm9/src/unk_0206B688.c | 48 ++--- arm9/src/unk_02088DD8.c | 6 +- include/constants/pokemon.h | 4 +- include/hall_of_fame.h | 4 +- include/pokedex.h | 36 ++-- include/pokemon.h | 12 +- include/poketch.h | 2 +- include/scrcmd.h | 6 +- include/unk_0206B688.h | 6 +- 24 files changed, 310 insertions(+), 310 deletions(-) diff --git a/arm9/asm/NNS_G2D_g2d_renderer.s b/arm9/asm/NNS_G2D_g2d_renderer.s index 5cd5eaac5..3d193baf6 100644 --- a/arm9/asm/NNS_G2D_g2d_renderer.s +++ b/arm9/asm/NNS_G2D_g2d_renderer.s @@ -3,8 +3,8 @@ .section .data - .global firstSRTransformedMtxIdx_ -firstSRTransformedMtxIdx_: ; 0x02106570 + .global firstSRTransformdMtxIdx_ +firstSRTransformdMtxIdx_: ; 0x02106570 .short -2 .balign 4, 0 @@ -111,7 +111,7 @@ NNS_G2dRotZ: ; 0x020B2794 ldr r0, [r0, #0x0] cmp r0, #0x0 bne _020B2824 - ldr r1, _020B28A4 ; =firstSRTransformedMtxIdx_ + ldr r1, _020B28A4 ; =firstSRTransformdMtxIdx_ ldr r0, _020B28A8 ; =0x0000FFFE ldrh r1, [r1, #0x0] cmp r1, r0 @@ -122,7 +122,7 @@ _020B2824: _020B2828: cmp r0, #0x0 ldreq r1, _020B2894 ; =stackPos_ - ldreq r0, _020B28A4 ; =firstSRTransformedMtxIdx_ + ldreq r0, _020B28A4 ; =firstSRTransformdMtxIdx_ ldreq r1, [r1, #0x0] streqh r1, [r0, #0x0] ldr r0, _020B2894 ; =stackPos_ @@ -155,7 +155,7 @@ _020B2894: .word stackPos_ _020B2898: .word mtxStack_ _020B289C: .word mtxStackFor2DHW_ _020B28A0: .word bDonotUseSRTransform -_020B28A4: .word firstSRTransformedMtxIdx_ +_020B28A4: .word firstSRTransformdMtxIdx_ _020B28A8: .word 0x0000FFFE _020B28AC: .word mtxStateStack_ _020B28B0: .word groupID_ @@ -206,7 +206,7 @@ NNS_G2dScale: ; 0x020B28B4 ldr r0, [r0, #0x0] cmp r0, #0x0 bne _020B2978 - ldr r1, _020B29F8 ; =firstSRTransformedMtxIdx_ + ldr r1, _020B29F8 ; =firstSRTransformdMtxIdx_ ldr r0, _020B29FC ; =0x0000FFFE ldrh r1, [r1, #0x0] cmp r1, r0 @@ -217,7 +217,7 @@ _020B2978: _020B297C: cmp r0, #0x0 ldreq r1, _020B29E8 ; =stackPos_ - ldreq r0, _020B29F8 ; =firstSRTransformedMtxIdx_ + ldreq r0, _020B29F8 ; =firstSRTransformdMtxIdx_ ldreq r1, [r1, #0x0] streqh r1, [r0, #0x0] ldr r0, _020B29E8 ; =stackPos_ @@ -250,7 +250,7 @@ _020B29E8: .word stackPos_ _020B29EC: .word mtxStack_ _020B29F0: .word mtxStackFor2DHW_ _020B29F4: .word bDonotUseSRTransform -_020B29F8: .word firstSRTransformedMtxIdx_ +_020B29F8: .word firstSRTransformdMtxIdx_ _020B29FC: .word 0x0000FFFE _020B2A00: .word mtxStateStack_ _020B2A04: .word groupID_ @@ -336,7 +336,7 @@ NNS_G2dPopMtx: ; 0x020B2B08 cmp r0, #0x0 bxne lr ldr r1, _020B2B4C ; =stackPos_ - ldr r0, _020B2B50 ; =firstSRTransformedMtxIdx_ + ldr r0, _020B2B50 ; =firstSRTransformdMtxIdx_ ldr r3, [r1, #0x0] ldrh r2, [r0, #0x0] sub r3, r3, #0x1 @@ -347,7 +347,7 @@ NNS_G2dPopMtx: ; 0x020B2B08 bx lr .balign 4 _020B2B4C: .word stackPos_ -_020B2B50: .word firstSRTransformedMtxIdx_ +_020B2B50: .word firstSRTransformdMtxIdx_ _020B2B54: .word 0x0000FFFE arm_func_end NNS_G2dPopMtx @@ -863,7 +863,7 @@ NNS_G2dBeginRendering: ; 0x020B326C ldr r2, _020B3314 ; =stackPos_ mov r4, #0x0 ldr r7, _020B3318 ; =0x0000FFFE - ldr r1, _020B331C ; =firstSRTransformedMtxIdx_ + ldr r1, _020B331C ; =firstSRTransformdMtxIdx_ str r0, [r3, #0x0] str r4, [r2, #0x0] strh r7, [r1, #0x0] @@ -903,7 +903,7 @@ _020B330C: .word currentMtxCachePos_ _020B3310: .word pCurrentInstance_ _020B3314: .word stackPos_ _020B3318: .word 0x0000FFFE -_020B331C: .word firstSRTransformedMtxIdx_ +_020B331C: .word firstSRTransformdMtxIdx_ _020B3320: .word mtxCacheBuffer_ _020B3324: .word groupID_ _020B3328: .word mtxStateStack_ @@ -967,7 +967,7 @@ NNS_G2dInitRenderer: ; 0x020B33A0 ldr r1, _020B3454 ; =stackPos_ strh r7, [r4, #0x94] ldr r2, _020B3458 ; =0x0000FFFE - ldr r0, _020B345C ; =firstSRTransformedMtxIdx_ + ldr r0, _020B345C ; =firstSRTransformdMtxIdx_ ldr r6, _020B3460 ; =mtxCacheBuffer_ str r7, [r1, #0x0] strh r2, [r0, #0x0] @@ -998,7 +998,7 @@ _020B3400: .balign 4 _020B3454: .word stackPos_ _020B3458: .word 0x0000FFFE -_020B345C: .word firstSRTransformedMtxIdx_ +_020B345C: .word firstSRTransformdMtxIdx_ _020B3460: .word mtxCacheBuffer_ _020B3464: .word currentMtxCachePos_ _020B3468: .word groupID_ @@ -1193,7 +1193,7 @@ DrawCellImpl_: ; 0x020B36C0 ldr r0, [r0, #0x0] cmp r0, #0x0 bne _020B3720 - ldr r2, _020B3B5C ; =firstSRTransformedMtxIdx_ + ldr r2, _020B3B5C ; =firstSRTransformdMtxIdx_ ldr r0, _020B3B60 ; =0x0000FFFE ldrh r2, [r2, #0x0] cmp r2, r0 @@ -1354,7 +1354,7 @@ _020B3908: ldr r0, [r0, #0x0] cmp r0, #0x0 bne _020B3978 - ldr r0, _020B3B5C ; =firstSRTransformedMtxIdx_ + ldr r0, _020B3B5C ; =firstSRTransformdMtxIdx_ ldrh r2, [r0, #0x0] ldr r0, _020B3B60 ; =0x0000FFFE cmp r2, r0 @@ -1494,7 +1494,7 @@ _020B3B40: .balign 4 _020B3B54: .word pCurrentInstance_ _020B3B58: .word bDonotUseSRTransform -_020B3B5C: .word firstSRTransformedMtxIdx_ +_020B3B5C: .word firstSRTransformdMtxIdx_ _020B3B60: .word 0x0000FFFE _020B3B64: .word mcRenderState_ _020B3B68: .word mcRenderState_ + 0x4 diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index 9ba979edf..e4bdd8b63 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -298,7 +298,7 @@ gScriptCmdTable: ; 0x020F355C .word ScrCmd_GetSphereCount .word ScrCmd_GetSealCountFromId .word ScrCmd_GiveSeals - .word ScrCmd_GetPokemonForme + .word ScrCmd_GetPokemonForm .word ScrCmd_GiveMon .word ScrCmd_GiveEgg .word ScrCmd_SetPartyMonMove @@ -760,8 +760,8 @@ gScriptCmdTable: ; 0x020F355C .word ScrCmd_AddSpecialGameStat .word ScrCmd_GetFashionName .word ScrCmd_CheckPokemonInParty - .word ScrCmd_SetDeoxysForme - .word ScrCmd_CheckBurmyFormes + .word ScrCmd_SetDeoxysForm + .word ScrCmd_CheckBurmyForms .word ScrCmd_Unk0265 .word ScrCmd_Unk0266 .word ScrCmd_Unk0267 diff --git a/arm9/asm/unk_0206F3FC.s b/arm9/asm/unk_0206F3FC.s index 1edb2ec76..91bd6b305 100644 --- a/arm9/asm/unk_0206F3FC.s +++ b/arm9/asm/unk_0206F3FC.s @@ -5675,7 +5675,7 @@ sub_02072080: ; 0x02072080 add r2, sp, #0x0 bl SetMonData add r0, r5, #0x0 - bl Pokemon_UpdateArceusForme + bl Pokemon_UpdateArceusForm ldr r1, _020720D8 ; =0x00000B25 ldr r0, _020720D4 ; =0x000005A4 ldrb r3, [r4, r1] @@ -5718,7 +5718,7 @@ sub_020720E0: ; 0x020720E0 add r2, sp, #0x1c bl SetMonData add r0, r5, #0x0 - bl Pokemon_UpdateArceusForme + bl Pokemon_UpdateArceusForm ldr r1, _02072138 ; =0x00000B25 mov r2, #0x2c ldrb r3, [r4, r1] diff --git a/arm9/asm/unk_02073DA8.s b/arm9/asm/unk_02073DA8.s index be19a7cd4..dc4428e7b 100644 --- a/arm9/asm/unk_02073DA8.s +++ b/arm9/asm/unk_02073DA8.s @@ -246,7 +246,7 @@ _02073F66: add r2, sp, #0x0 bl SetMonData add r0, r6, #0x0 - bl Pokemon_UpdateArceusForme + bl Pokemon_UpdateArceusForm ldr r2, _02074058 ; =0x0000069C mov r1, #0x52 ldr r0, [r5, r2] @@ -633,7 +633,7 @@ sub_020742A8: ; 0x020742A8 add r2, sp, #0x0 bl SetMonData add r0, r5, #0x0 - bl Pokemon_UpdateArceusForme + bl Pokemon_UpdateArceusForm ldr r1, _02074330 ; =0x00000B25 mov r2, #0x2c ldrb r3, [r4, r1] diff --git a/arm9/global.inc b/arm9/global.inc index 940d0d43d..16262c61f 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -1552,15 +1552,15 @@ .extern sub_02024674 .extern Pokedex_GetSeenUnownI .extern Pokedex_CountSeenUnown -.extern Pokedex_GetSeenShellosForme +.extern Pokedex_GetSeenShellosForm .extern Pokedex_CountSeenShellos -.extern Pokedex_GetSeenGastrodonForme +.extern Pokedex_GetSeenGastrodonForm .extern Pokedex_CountSeenGastrodon -.extern Pokedex_GetSeenBurmyForme +.extern Pokedex_GetSeenBurmyForm .extern Pokedex_CountSeenBurmy -.extern Pokedex_GetSeenWormadamForme +.extern Pokedex_GetSeenWormadamForm .extern Pokedex_CountSeenWormadam -.extern Pokedex_GetSeenDeoxysForme +.extern Pokedex_GetSeenDeoxysForm .extern Pokedex_CountSeenDeoxys .extern Pokedex_SetMonSeenFlag .extern Pokedex_SetMonCaughtFlag @@ -1574,7 +1574,7 @@ .extern Pokedex_GetSinnohDexFlag .extern Pokedex_SetSinnohDexFlag .extern Save_Pokedex_Get -.extern Pokedex_GetSeenMonForme +.extern Pokedex_GetSeenMonForm .extern sub_02024E64 .extern sub_02024E6C .extern sub_02024EB4 @@ -2810,7 +2810,7 @@ .extern ScrCmd_Unk02AB .extern ScrCmd_GetSealCountFromId .extern ScrCmd_GiveSeals -.extern ScrCmd_GetPokemonForme +.extern ScrCmd_GetPokemonForm .extern ScrCmd_ChoosePokemonMenu .extern ScrCmd_OpenTradeScreen .extern ScrCmd_UnionChoosePokemonMenu @@ -3063,8 +3063,8 @@ .extern ScrCmd_Unk025F .extern ScrCmd_AddSpecialGameStat .extern ScrCmd_CheckPokemonInParty -.extern ScrCmd_SetDeoxysForme -.extern ScrCmd_CheckBurmyFormes +.extern ScrCmd_SetDeoxysForm +.extern ScrCmd_CheckBurmyForms .extern ScrCmd_Unk0265 .extern ScrCmd_Unk0266 .extern ScrCmd_Unk0267 @@ -4749,7 +4749,7 @@ .extern AllocAndLoadMonPersonal .extern GetPersonalAttr .extern FreeMonPersonal -.extern GetMonBaseStat_HandleFormeConversion +.extern GetMonBaseStat_HandleFormConversion .extern GetMonBaseStat .extern GetPercentProgressTowardsNextLevel .extern CalcMonExpToNextLevel @@ -4812,10 +4812,10 @@ .extern Party_SpreadPokerus .extern Pokemon_HasPokerus .extern Pokemon_IsImmuneToPokerus -.extern Pokemon_UpdateArceusForme -.extern BoxMon_UpdateArceusForme +.extern Pokemon_UpdateArceusForm +.extern BoxMon_UpdateArceusForm .extern GetArceusTypeByHeldItemEffect -.extern LoadWotbl_HandleAlternateForme +.extern LoadWotbl_HandleAlternateForm .extern sub_02069FB0 .extern sub_0206A014 .extern sub_0206A094 @@ -4868,7 +4868,7 @@ .extern sub_0206B688 .extern sub_0206B6C8 .extern sub_0206B6D4 -.extern BoxMon_GetAlternateForme +.extern BoxMon_GetAlternateForm .extern sub_0206B7BC .extern sub_0206B87C .extern sub_0206B888 diff --git a/arm9/overlays/11/asm/ov11_02232264.s b/arm9/overlays/11/asm/ov11_02232264.s index 1ba829b0b..7f1a498ea 100644 --- a/arm9/overlays/11/asm/ov11_02232264.s +++ b/arm9/overlays/11/asm/ov11_02232264.s @@ -11026,7 +11026,7 @@ _02237900: ldr r0, [sp, #4] add r1, r6, #0 mov r2, #1 ; BASE_ATK - bl GetMonBaseStat_HandleFormeConversion + bl GetMonBaseStat_HandleFormConversion ldr r1, _02237AB0 ; =0x00002144 ldr r2, _02237AB4 ; =0x00003044 str r0, [r5, r1] @@ -11058,7 +11058,7 @@ _02237900: mov r2, #2 ; BASE_DEF lsl r1, r1, #0x1b lsr r1, r1, #0x1b - bl GetMonBaseStat_HandleFormeConversion + bl GetMonBaseStat_HandleFormConversion add r1, r0, #0 ldr r0, _02237AB0 ; =0x00002144 ldr r0, [r5, r0] diff --git a/arm9/overlays/14/asm/overlay_14.s b/arm9/overlays/14/asm/overlay_14.s index e0fe44898..cd2c1a8d7 100644 --- a/arm9/overlays/14/asm/overlay_14.s +++ b/arm9/overlays/14/asm/overlay_14.s @@ -9633,7 +9633,7 @@ _021DC254: cmp r0, r1 bne _021DC26A ldr r0, [r4] - bl BoxMon_UpdateArceusForme + bl BoxMon_UpdateArceusForm _021DC26A: add sp, #4 pop {r3, r4, r5, r6} @@ -21843,7 +21843,7 @@ _021E204A: lsr r1, r0, #0x10 add r0, r7, #0 mov r2, #0x1b ; BASE_COLOR - bl GetMonBaseStat_HandleFormeConversion + bl GetMonBaseStat_HandleFormConversion lsl r0, r0, #0x18 lsr r1, r0, #0x18 b _021E20AA diff --git a/arm9/overlays/16/asm/overlay_16.s b/arm9/overlays/16/asm/overlay_16.s index 65f32be97..5137faca4 100644 --- a/arm9/overlays/16/asm/overlay_16.s +++ b/arm9/overlays/16/asm/overlay_16.s @@ -4747,7 +4747,7 @@ ov16_021D9904: ; 0x021D9904 _021D9912: ldr r0, [r5] add r1, r4, #0 - bl Pokedex_GetSeenShellosForme + bl Pokedex_GetSeenShellosForm pop {r3, r4, r5, pc} thumb_func_end ov16_021D9904 @@ -4762,7 +4762,7 @@ ov16_021D991C: ; 0x021D991C _021D992A: ldr r0, [r5] add r1, r4, #0 - bl Pokedex_GetSeenGastrodonForme + bl Pokedex_GetSeenGastrodonForm pop {r3, r4, r5, pc} thumb_func_end ov16_021D991C @@ -4777,7 +4777,7 @@ ov16_021D9934: ; 0x021D9934 _021D9942: ldr r0, [r5] add r1, r4, #0 - bl Pokedex_GetSeenBurmyForme + bl Pokedex_GetSeenBurmyForm pop {r3, r4, r5, pc} thumb_func_end ov16_021D9934 @@ -4792,7 +4792,7 @@ ov16_021D994C: ; 0x021D994C _021D995A: ldr r0, [r5] add r1, r4, #0 - bl Pokedex_GetSeenWormadamForme + bl Pokedex_GetSeenWormadamForm pop {r3, r4, r5, pc} thumb_func_end ov16_021D994C @@ -4937,11 +4937,11 @@ _021D9A38: .word Pokedex_GetSeenSpindaPersonality thumb_func_start ov16_021D9A3C ov16_021D9A3C: ; 0x021D9A3C - ldr r3, _021D9A44 ; =Pokedex_GetSeenDeoxysForme + ldr r3, _021D9A44 ; =Pokedex_GetSeenDeoxysForm ldr r0, [r0] bx r3 nop -_021D9A44: .word Pokedex_GetSeenDeoxysForme +_021D9A44: .word Pokedex_GetSeenDeoxysForm thumb_func_end ov16_021D9A3C thumb_func_start ov16_021D9A48 @@ -30399,12 +30399,12 @@ ov16_021E5554: ; 0x021E5554 ldr r1, [sp, #0x30] add r0, r7, #0 mov r2, #6 ; BASE_TYPE1 - bl GetMonBaseStat_HandleFormeConversion + bl GetMonBaseStat_HandleFormConversion add r6, r0, #0 ldr r1, [sp, #0x30] add r0, r7, #0 mov r2, #7 ; BASE_TYPE2 - bl GetMonBaseStat_HandleFormeConversion + bl GetMonBaseStat_HandleFormConversion add r7, r0, #0 add r0, r6, #0 bl ov16_021E563C diff --git a/arm9/overlays/84/asm/overlay_84_thumb2.s b/arm9/overlays/84/asm/overlay_84_thumb2.s index 820e267df..81e44a0ea 100644 --- a/arm9/overlays/84/asm/overlay_84_thumb2.s +++ b/arm9/overlays/84/asm/overlay_84_thumb2.s @@ -273,7 +273,7 @@ _021D82CC: add r0, r6, #0 add r1, r5, #0 mov r2, #0 - bl Pokedex_GetSeenMonForme + bl Pokedex_GetSeenMonForm ldr r1, _021D8428 ; =0x00001220 ldr r1, [r4, r1] lsl r1, r1, #3 @@ -387,7 +387,7 @@ _021D83E8: ldrh r1, [r4, r1] add r0, r6, #0 mov r2, #0 - bl Pokedex_GetSeenMonForme + bl Pokedex_GetSeenMonForm ldr r1, _021D8438 ; =0x000002BB add r5, r5, #1 strb r0, [r4, r1] diff --git a/arm9/src/hall_of_fame.c b/arm9/src/hall_of_fame.c index d857b0d20..24a35afec 100644 --- a/arm9/src/hall_of_fame.c +++ b/arm9/src/hall_of_fame.c @@ -37,7 +37,7 @@ void Save_HOF_RecordParty(struct HallOfFame * hof, struct PlayerParty * party, R { hof_party->party[j].species = (u16)GetMonData(mon, MON_DATA_SPECIES, NULL); hof_party->party[j].level = (u8)GetMonData(mon, MON_DATA_LEVEL, NULL); - hof_party->party[j].forme = (u8)GetMonData(mon, MON_DATA_FORME, NULL); + hof_party->party[j].form = (u8)GetMonData(mon, MON_DATA_FORM, NULL); hof_party->party[j].personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL); hof_party->party[j].otid = GetMonData(mon, MON_DATA_OTID, NULL); hof_party->party[j].moves[0] = (u16)GetMonData(mon, MON_DATA_MOVE1, NULL); @@ -121,7 +121,7 @@ void Save_HOF_GetMonStatsByIndexPair(struct HallOfFame * hof, int a1, int a2, st dest->level = mon->level; dest->personality = mon->personality; dest->otid = mon->otid; - dest->forme = mon->forme; + dest->form = mon->form; CopyU16ArrayToString(dest->nickname, mon->nickname); CopyU16ArrayToString(dest->otname, mon->otname); for (int i = 0; i < 4; i++) diff --git a/arm9/src/mail.c b/arm9/src/mail.c index e307a1285..ffd6ffbf0 100644 --- a/arm9/src/mail.c +++ b/arm9/src/mail.c @@ -8,7 +8,7 @@ #include "player_data.h" extern u32 sub_0206B6C8(struct Pokemon * pokemon); -extern u16 sub_0206B7BC(u16 species, u32 forme, BOOL is_egg); +extern u16 sub_0206B7BC(u16 species, u32 form, BOOL is_egg); void Mail_Init(struct Mail * mail) { @@ -49,7 +49,7 @@ void Mail_Copy(const struct Mail * src, struct Mail * dest) void Mail_SetNewMessageDetails(struct Mail * mail, u8 type, u8 monIdx, struct SaveData * save) { u32 sp10; - u32 forme; + u32 form; BOOL is_egg; u16 species; struct PlayerParty * party; @@ -72,9 +72,9 @@ void Mail_SetNewMessageDetails(struct Mail * mail, u8 type, u8 monIdx, struct Sa pokemon = GetPartyMonByIndex(party, monIdx); species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL); is_egg = (BOOL)GetMonData(pokemon, MON_DATA_IS_EGG, NULL); - forme = GetMonData(pokemon, MON_DATA_FORME, NULL); + form = GetMonData(pokemon, MON_DATA_FORM, NULL); sp10 = sub_0206B6C8(pokemon); - r7 = sub_0206B7BC(species, forme, is_egg); + r7 = sub_0206B7BC(species, form, is_egg); ptr = &mail->unk_18[i]; ptr->bits.unk_0 = sp10; i++; diff --git a/arm9/src/pokedex.c b/arm9/src/pokedex.c index 27c765d73..f179afb50 100644 --- a/arm9/src/pokedex.c +++ b/arm9/src/pokedex.c @@ -67,7 +67,7 @@ s32 Pokedex_CountSeenShellosOrGastrodon_Internal(struct Pokedex * pokedex, u32 s return (r2 == r0) ? 1 : 2; } -BOOL Pokedex_HasSeenShellosOrGastrodonForme(struct Pokedex * pokedex, u32 species, u8 state) +BOOL Pokedex_HasSeenShellosOrGastrodonForm(struct Pokedex * pokedex, u32 species, u8 state) { GF_ASSERT(species == SPECIES_SHELLOS || species == SPECIES_GASTRODON); if (!Pokedex_CheckMonSeenFlag(pokedex, (u16)species)) @@ -83,10 +83,10 @@ BOOL Pokedex_HasSeenShellosOrGastrodonForme(struct Pokedex * pokedex, u32 specie return FALSE; } -void Pokedex_SetSeenShellosOrGastrodonForme(struct Pokedex * pokedex, u32 species, u32 state) +void Pokedex_SetSeenShellosOrGastrodonForm(struct Pokedex * pokedex, u32 species, u32 state) { GF_ASSERT(species == SPECIES_SHELLOS || species == SPECIES_GASTRODON); - if (Pokedex_HasSeenShellosOrGastrodonForme(pokedex, species, (u8)state)) + if (Pokedex_HasSeenShellosOrGastrodonForm(pokedex, species, (u8)state)) return; u8 *flags = species == SPECIES_SHELLOS ? &pokedex->shellosGastrodon[0] : &pokedex->shellosGastrodon[1]; s32 r5 = Pokedex_CountSeenShellosOrGastrodon_Internal(pokedex, species); @@ -116,7 +116,7 @@ s32 Pokedex_CountSeenBurmyOrWormadam_Internal(struct Pokedex * pokedex, u32 spec return i; } -BOOL Pokedex_HasSeenBurmyOrWormadamForme(struct Pokedex * pokedex, u32 species, u8 state) +BOOL Pokedex_HasSeenBurmyOrWormadamForm(struct Pokedex * pokedex, u32 species, u8 state) { GF_ASSERT(species == SPECIES_BURMY || species == SPECIES_WORMADAM); if (!Pokedex_CheckMonSeenFlag(pokedex, (u16)species)) @@ -132,10 +132,10 @@ BOOL Pokedex_HasSeenBurmyOrWormadamForme(struct Pokedex * pokedex, u32 species, return FALSE; } -void Pokedex_SetSeenBurmyOrWormadamForme(struct Pokedex * pokedex, u32 species, s32 state) +void Pokedex_SetSeenBurmyOrWormadamForm(struct Pokedex * pokedex, u32 species, s32 state) { GF_ASSERT(species == SPECIES_BURMY || species == SPECIES_WORMADAM); - if (Pokedex_HasSeenBurmyOrWormadamForme(pokedex, species, (u8)state)) + if (Pokedex_HasSeenBurmyOrWormadamForm(pokedex, species, (u8)state)) return; u8 *flags = species == SPECIES_BURMY ? &pokedex->burmyWormadam[0] : &pokedex->burmyWormadam[1]; s32 r5 = Pokedex_CountSeenBurmyOrWormadam_Internal(pokedex, species); @@ -144,7 +144,7 @@ void Pokedex_SetSeenBurmyOrWormadamForme(struct Pokedex * pokedex, u32 species, UpdateDexFlagPair(flags, (u16)r5, (u8)state); } -static inline void SetDeoxysFormeFlag(struct Pokedex * pokedex, u8 r4, u8 r6) +static inline void SetDeoxysFormFlag(struct Pokedex * pokedex, u8 r4, u8 r6) { GF_ASSERT(r6 < 4); GF_ASSERT(r4 <= 15); @@ -161,12 +161,12 @@ static inline void SetDeoxysFormeFlag(struct Pokedex * pokedex, u8 r4, u8 r6) } } -void Pokedex_SetSeenDeoxysFormeAt(struct Pokedex * pokedex, u8 r4, u8 r6) +void Pokedex_SetSeenDeoxysFormAt(struct Pokedex * pokedex, u8 r4, u8 r6) { - SetDeoxysFormeFlag(pokedex, r4, r6); + SetDeoxysFormFlag(pokedex, r4, r6); } -static inline u32 GetDeoxysFormeFlag_Internal(struct Pokedex * pokedex, u8 r6) +static inline u32 GetDeoxysFormFlag_Internal(struct Pokedex * pokedex, u8 r6) { if (r6 < 2) { @@ -179,46 +179,46 @@ static inline u32 GetDeoxysFormeFlag_Internal(struct Pokedex * pokedex, u8 r6) } } -s32 Pokedex_CountSeenDeoxysFormes_Internal(struct Pokedex * pokedex) +s32 Pokedex_CountSeenDeoxysForms_Internal(struct Pokedex * pokedex) { s32 i; for (i = 0; i < 4; i++) { - u32 r2 = GetDeoxysFormeFlag_Internal(pokedex, (u8)i); + u32 r2 = GetDeoxysFormFlag_Internal(pokedex, (u8)i); if (r2 == 15) break; } return i; } -BOOL Pokedex_HasSeenDeoxysForme(struct Pokedex * pokedex, u32 state) +BOOL Pokedex_HasSeenDeoxysForm(struct Pokedex * pokedex, u32 state) { s32 i; for (i = 0; i < 4; i++) { - u32 r4 = GetDeoxysFormeFlag_Internal(pokedex, (u8)i); + u32 r4 = GetDeoxysFormFlag_Internal(pokedex, (u8)i); if (state == r4) return TRUE; } return FALSE; } -void Pokedex_TrySetSeenDeoxysForme(struct Pokedex * pokedex, u16 species, struct Pokemon * pokemon) +void Pokedex_TrySetSeenDeoxysForm(struct Pokedex * pokedex, u16 species, struct Pokemon * pokemon) { - u8 forme = (u8)GetMonData(pokemon, MON_DATA_FORME, NULL); - if (species == SPECIES_DEOXYS && !Pokedex_HasSeenDeoxysForme(pokedex, forme)) + u8 form = (u8)GetMonData(pokemon, MON_DATA_FORM, NULL); + if (species == SPECIES_DEOXYS && !Pokedex_HasSeenDeoxysForm(pokedex, form)) { - s32 r2 = Pokedex_CountSeenDeoxysFormes_Internal(pokedex); - Pokedex_SetSeenDeoxysFormeAt(pokedex, forme, (u8)r2); + s32 r2 = Pokedex_CountSeenDeoxysForms_Internal(pokedex); + Pokedex_SetSeenDeoxysFormAt(pokedex, form, (u8)r2); } } -void Pokedex_InitSeenDeoxysFormesArray(struct Pokedex * pokedex) +void Pokedex_InitSeenDeoxysFormsArray(struct Pokedex * pokedex) { s32 i; for (i = 0; i < 4; i++) { - Pokedex_SetSeenDeoxysFormeAt(pokedex, 15, (u8)i); + Pokedex_SetSeenDeoxysFormAt(pokedex, 15, (u8)i); } } @@ -258,7 +258,7 @@ static inline void SetSeenUnownLetter(struct Pokedex * pokedex, u32 species, s32 pokedex->seenUnown[idx] = (u8)letter; } -void Pokedex_SetMonSeenForme(struct Pokedex * pokedex, u16 species, struct Pokemon * pokemon) +void Pokedex_SetMonSeenForm(struct Pokedex * pokedex, u16 species, struct Pokemon * pokemon) { if (species == SPECIES_UNOWN) { @@ -266,23 +266,23 @@ void Pokedex_SetMonSeenForme(struct Pokedex * pokedex, u16 species, struct Pokem } else if (species == SPECIES_BURMY) { - Pokedex_SetSeenBurmyOrWormadamForme(pokedex, species, (s32)GetMonData(pokemon, MON_DATA_FORME, NULL)); + Pokedex_SetSeenBurmyOrWormadamForm(pokedex, species, (s32)GetMonData(pokemon, MON_DATA_FORM, NULL)); } else if (species == SPECIES_WORMADAM) { - Pokedex_SetSeenBurmyOrWormadamForme(pokedex, species, (s32)GetMonData(pokemon, MON_DATA_FORME, NULL)); + Pokedex_SetSeenBurmyOrWormadamForm(pokedex, species, (s32)GetMonData(pokemon, MON_DATA_FORM, NULL)); } else if (species == SPECIES_SHELLOS) { - Pokedex_SetSeenShellosOrGastrodonForme(pokedex, species, GetMonData(pokemon, MON_DATA_FORME, NULL)); + Pokedex_SetSeenShellosOrGastrodonForm(pokedex, species, GetMonData(pokemon, MON_DATA_FORM, NULL)); } else if (species == SPECIES_GASTRODON) { - Pokedex_SetSeenShellosOrGastrodonForme(pokedex, species, GetMonData(pokemon, MON_DATA_FORME, NULL)); + Pokedex_SetSeenShellosOrGastrodonForm(pokedex, species, GetMonData(pokemon, MON_DATA_FORM, NULL)); } else if (species == SPECIES_DEOXYS) { - Pokedex_TrySetSeenDeoxysForme(pokedex, species, pokemon); + Pokedex_TrySetSeenDeoxysForm(pokedex, species, pokemon); } } @@ -364,7 +364,7 @@ void Save_Pokedex_Init(struct Pokedex * pokedex) pokedex->shellosGastrodon[1] = 0xFF; pokedex->burmyWormadam[0] = 0xFF; pokedex->burmyWormadam[1] = 0xFF; - Pokedex_InitSeenDeoxysFormesArray(pokedex); + Pokedex_InitSeenDeoxysFormsArray(pokedex); } u16 Pokedex_CountNationalDexOwned(struct Pokedex * pokedex) @@ -538,7 +538,7 @@ s32 Pokedex_CountSeenUnown(struct Pokedex * pokedex) return FindFirstAvailableUnownLetterSlot_2(pokedex); } -BOOL Pokedex_GetSeenShellosForme(struct Pokedex * pokedex, s32 a1) +BOOL Pokedex_GetSeenShellosForm(struct Pokedex * pokedex, s32 a1) { GF_ASSERT(pokedex->magic == 0xBEEFCAFE); if (Pokedex_CountSeenShellosOrGastrodon_Internal(pokedex, SPECIES_SHELLOS) <= a1) @@ -553,7 +553,7 @@ s32 Pokedex_CountSeenShellos(struct Pokedex * pokedex) return Pokedex_CountSeenShellosOrGastrodon_Internal(pokedex, SPECIES_SHELLOS); } -BOOL Pokedex_GetSeenGastrodonForme(struct Pokedex * pokedex, s32 a1) +BOOL Pokedex_GetSeenGastrodonForm(struct Pokedex * pokedex, s32 a1) { GF_ASSERT(pokedex->magic == 0xBEEFCAFE); if (Pokedex_CountSeenShellosOrGastrodon_Internal(pokedex, SPECIES_GASTRODON) <= a1) @@ -568,7 +568,7 @@ s32 Pokedex_CountSeenGastrodon(struct Pokedex * pokedex) return Pokedex_CountSeenShellosOrGastrodon_Internal(pokedex, SPECIES_GASTRODON); } -s32 Pokedex_GetSeenBurmyForme(struct Pokedex * pokedex, s32 a1) +s32 Pokedex_GetSeenBurmyForm(struct Pokedex * pokedex, s32 a1) { GF_ASSERT(pokedex->magic == 0xBEEFCAFE); if (Pokedex_CountSeenBurmyOrWormadam_Internal(pokedex, SPECIES_BURMY) <= a1) @@ -583,7 +583,7 @@ s32 Pokedex_CountSeenBurmy(struct Pokedex * pokedex) return Pokedex_CountSeenBurmyOrWormadam_Internal(pokedex, SPECIES_BURMY); } -s32 Pokedex_GetSeenWormadamForme(struct Pokedex * pokedex, s32 a1) +s32 Pokedex_GetSeenWormadamForm(struct Pokedex * pokedex, s32 a1) { GF_ASSERT(pokedex->magic == 0xBEEFCAFE); if (Pokedex_CountSeenBurmyOrWormadam_Internal(pokedex, SPECIES_WORMADAM) <= a1) @@ -598,16 +598,16 @@ s32 Pokedex_CountSeenWormadam(struct Pokedex * pokedex) return Pokedex_CountSeenBurmyOrWormadam_Internal(pokedex, SPECIES_WORMADAM); } -s32 Pokedex_GetSeenDeoxysForme(struct Pokedex * pokedex, s32 a1) +s32 Pokedex_GetSeenDeoxysForm(struct Pokedex * pokedex, s32 a1) { GF_ASSERT(pokedex->magic == 0xBEEFCAFE); - return (s32)GetDeoxysFormeFlag_Internal(pokedex, (u8)a1); + return (s32)GetDeoxysFormFlag_Internal(pokedex, (u8)a1); } s32 Pokedex_CountSeenDeoxys(struct Pokedex * pokedex) { GF_ASSERT(pokedex->magic == 0xBEEFCAFE); - return Pokedex_CountSeenDeoxysFormes_Internal(pokedex); + return Pokedex_CountSeenDeoxysForms_Internal(pokedex); } static inline void SetSeenCaughtGender(struct Pokedex * pokedex, u16 species, u8 gender) @@ -649,7 +649,7 @@ void Pokedex_SetMonSeenFlag(struct Pokedex * pokedex, struct Pokemon * pokemon) SetSeenGender(pokedex, species, (u8)gender); } } - Pokedex_SetMonSeenForme(pokedex, species, pokemon); + Pokedex_SetMonSeenForm(pokedex, species, pokemon); SetDexFlag(pokedex->seenFlags, species); } @@ -681,7 +681,7 @@ void Pokedex_SetMonCaughtFlag(struct Pokedex * pokedex, struct Pokemon * pokemon SetSeenGender(pokedex, species, (u8)gender); } } - Pokedex_SetMonSeenForme(pokedex, species, pokemon); + Pokedex_SetMonSeenForm(pokedex, species, pokemon); Pokedex_SetMeisterFlagBySpeciesAndLanguage(pokedex, species, language); SetDexFlag(pokedex->caughtFlags, species); SetDexFlag(pokedex->seenFlags, species); @@ -749,33 +749,33 @@ struct Pokedex * Save_Pokedex_Get(struct SaveData * save) return (struct Pokedex *)SaveArray_Get(save, 7); } -s32 Pokedex_GetSeenMonForme(struct Pokedex * pokedex, s32 species, u32 forme) +s32 Pokedex_GetSeenMonForm(struct Pokedex * pokedex, s32 species, u32 form) { switch (species) { case SPECIES_UNOWN: - if (forme < Pokedex_CountSeenUnown(pokedex)) - return Pokedex_GetSeenUnownI(pokedex, (s32)forme); + if (form < Pokedex_CountSeenUnown(pokedex)) + return Pokedex_GetSeenUnownI(pokedex, (s32)form); break; case SPECIES_SHELLOS: - if (forme < Pokedex_CountSeenShellos(pokedex)) - return Pokedex_GetSeenShellosForme(pokedex, (s32)forme); + if (form < Pokedex_CountSeenShellos(pokedex)) + return Pokedex_GetSeenShellosForm(pokedex, (s32)form); break; case SPECIES_GASTRODON: - if (forme < Pokedex_CountSeenGastrodon(pokedex)) - return Pokedex_GetSeenGastrodonForme(pokedex, (s32)forme); + if (form < Pokedex_CountSeenGastrodon(pokedex)) + return Pokedex_GetSeenGastrodonForm(pokedex, (s32)form); break; case SPECIES_BURMY: - if (forme < Pokedex_CountSeenBurmy(pokedex)) - return Pokedex_GetSeenBurmyForme(pokedex, (s32)forme); + if (form < Pokedex_CountSeenBurmy(pokedex)) + return Pokedex_GetSeenBurmyForm(pokedex, (s32)form); break; case SPECIES_WORMADAM: - if (forme < Pokedex_CountSeenWormadam(pokedex)) - return Pokedex_GetSeenWormadamForme(pokedex, (s32)forme); + if (form < Pokedex_CountSeenWormadam(pokedex)) + return Pokedex_GetSeenWormadamForm(pokedex, (s32)form); break; case SPECIES_DEOXYS: - if (forme < Pokedex_CountSeenDeoxys(pokedex)) - return Pokedex_GetSeenDeoxysForme(pokedex, (s32)forme); + if (form < Pokedex_CountSeenDeoxys(pokedex)) + return Pokedex_GetSeenDeoxysForm(pokedex, (s32)form); break; } return 0; diff --git a/arm9/src/pokemon.c b/arm9/src/pokemon.c index 73e11764a..5b82bb4ca 100644 --- a/arm9/src/pokemon.c +++ b/arm9/src/pokemon.c @@ -42,24 +42,24 @@ s8 GetFlavorPreferenceFromPID(u32 personality, int flavor); u8 Party_MaskMonsWithPokerus(struct PlayerParty * party_p, u8 mask); BOOL BoxMon_HasPokerus(struct BoxPokemon * boxmon); BOOL BoxMon_IsImmuneToPokerus(struct BoxPokemon * boxmon); -void BoxMon_UpdateArceusForme(struct BoxPokemon * boxmon); -void LoadWotbl_HandleAlternateForme(int species, int forme, u16 * wotbl); +void BoxMon_UpdateArceusForm(struct BoxPokemon * boxmon); +void LoadWotbl_HandleAlternateForm(int species, int form, u16 * wotbl); void sub_0206A054(struct BoxPokemon * boxmon, PlayerProfile * a1, u32 pokeball, u32 a3, u32 encounterType, HeapID heapId); BOOL MonHasMove(struct Pokemon * pokemon, u16 move); BOOL sub_0206A144(struct BoxPokemon * boxmon, u32 a1); -BOOL sub_0206A16C(u16 species, int forme, u32 a2); +BOOL sub_0206A16C(u16 species, int form, u32 a2); void sub_0206A1CC(struct BoxPokemon * boxmon); u32 MaskOfFlagNo(int flagno); void LoadMonPersonal(int species, struct BaseStats * personal); void LoadMonEvolutionTable(u16 species, struct Evolution * dest); -int ResolveMonForme(int species, int forme); +int ResolveMonForm(int species, int form); void MonEncryptSegment(u16 * datap, u32 size, u32 key); void MonDecryptSegment(u16 * datap, u32 size, u32 key); u16 MonEncryptionLCRNG(u32 * seed); u16 CalcMonChecksum(u16 * datap, u32 size); PokemonDataBlock * GetSubstruct(struct BoxPokemon * boxmon, u32 personality, u8 which_struct); -void LoadMonBaseStats_HandleAlternateForme(int species, int forme, struct BaseStats * baseStats); +void LoadMonBaseStats_HandleAlternateForm(int species, int form, struct BaseStats * baseStats); u8 GetBoxMonUnownLetter(struct BoxPokemon * boxmon); #define ENCRY_ARGS_PTY(mon) (u16 *)&(mon)->party, sizeof((mon)->party), (mon)->box.pid @@ -438,7 +438,7 @@ void CalcMonStats(struct Pokemon * pokemon) int speedEv; int spatkEv; int spdefEv; - int forme; + int form; int hp; int species; int newMaxHp; @@ -463,11 +463,11 @@ void CalcMonStats(struct Pokemon * pokemon) spatkEv = (int)GetMonData(pokemon, MON_DATA_SPATK_EV, NULL); spdefIv = (int)GetMonData(pokemon, MON_DATA_SPDEF_IV, NULL); spdefEv = (int)GetMonData(pokemon, MON_DATA_SPDEF_EV, NULL); - forme = (int)GetMonData(pokemon, MON_DATA_FORME, NULL); + form = (int)GetMonData(pokemon, MON_DATA_FORM, NULL); species = (int)GetMonData(pokemon, MON_DATA_SPECIES, NULL); baseStats = (struct BaseStats *)AllocFromHeap(HEAP_ID_DEFAULT, sizeof(struct BaseStats)); - LoadMonBaseStats_HandleAlternateForme(species, forme, baseStats); + LoadMonBaseStats_HandleAlternateForm(species, form, baseStats); if (species == SPECIES_SHEDINJA) newMaxHp = 1; @@ -837,8 +837,8 @@ u32 GetBoxMonDataInternal(struct BoxPokemon * boxmon, int attr, void * dest) case MON_DATA_GENDER: ret = blockB->gender; break; - case MON_DATA_FORME: - ret = blockB->alternateForme; + case MON_DATA_FORM: + ret = blockB->alternateForm; break; case MON_DATA_RESERVED_113: ret = blockB->HGSS_shinyLeaves; @@ -979,7 +979,7 @@ u32 GetBoxMonDataInternal(struct BoxPokemon * boxmon, int attr, void * dest) ret = (u32)GetArceusTypeByHeldItemEffect((u16)GetItemAttr(blockA->heldItem, 1, HEAP_ID_DEFAULT)); else { - ret = (u32)GetMonBaseStat_HandleFormeConversion(blockA->species, blockB->alternateForme, (enum BaseStat)(attr - MON_DATA_TYPE_1 + BASE_TYPE1)); + ret = (u32)GetMonBaseStat_HandleFormConversion(blockA->species, blockB->alternateForm, (enum BaseStat)(attr - MON_DATA_TYPE_1 + BASE_TYPE1)); } break; case MON_DATA_SPECIES_NAME: @@ -1304,8 +1304,8 @@ void SetBoxMonDataInternal(struct BoxPokemon * boxmon, int attr, void * value) case MON_DATA_GENDER: blockB->gender = VALUE(u8); break; - case MON_DATA_FORME: - blockB->alternateForme = VALUE(u8); + case MON_DATA_FORM: + blockB->alternateForm = VALUE(u8); break; case MON_DATA_RESERVED_113: blockB->HGSS_shinyLeaves = VALUE(u8); @@ -1702,7 +1702,7 @@ void AddBoxMonData(struct BoxPokemon * boxmon, int attr, int value) case MON_DATA_HOENN_WORLD_RIBBON: case MON_DATA_FATEFUL_ENCOUNTER: case MON_DATA_GENDER: - case MON_DATA_FORME: + case MON_DATA_FORM: case MON_DATA_RESERVED_113: case MON_DATA_RESERVED_114: case MON_DATA_UNUSED_115: @@ -1896,10 +1896,10 @@ void FreeMonPersonal(struct BaseStats * personal) FreeToHeap(personal); } -int GetMonBaseStat_HandleFormeConversion(int species, int forme, enum BaseStat attr) +int GetMonBaseStat_HandleFormConversion(int species, int form, enum BaseStat attr) { int ret; - struct BaseStats * personal = AllocAndLoadMonPersonal(ResolveMonForme(species, forme), HEAP_ID_DEFAULT); + struct BaseStats * personal = AllocAndLoadMonPersonal(ResolveMonForm(species, form), HEAP_ID_DEFAULT); ret = GetPersonalAttr(personal, attr); FreeMonPersonal(personal); return ret; @@ -2183,21 +2183,21 @@ void sub_02068B70(struct SomeDrawPokemonStruct * spC, struct BoxPokemon * boxmon u8 gender = GetBoxMonGender(boxmon); u8 shiny = BoxMonIsShiny(boxmon); u32 personality = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL); - u8 forme; + u8 form; if (species == SPECIES_EGG) { if (GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL) == SPECIES_MANAPHY) - forme = 1; + form = 1; else - forme = 0; + form = 0; } else - forme = (u8)GetBoxMonData(boxmon, MON_DATA_FORME, NULL); - sub_02068C00(spC, species, gender, sp10, shiny, forme, personality); + form = (u8)GetBoxMonData(boxmon, MON_DATA_FORM, NULL); + sub_02068C00(spC, species, gender, sp10, shiny, form, personality); ReleaseBoxMonLock(boxmon, decry); } -void sub_02068C00(struct SomeDrawPokemonStruct * spC, int species, u8 gender, u8 sp10, u8 shiny, u8 forme, u32 personality) +void sub_02068C00(struct SomeDrawPokemonStruct * spC, int species, u8 gender, u8 sp10, u8 shiny, u8 form, u32 personality) { spC->unk6 = 0; spC->unk8 = 0; @@ -2205,74 +2205,74 @@ void sub_02068C00(struct SomeDrawPokemonStruct * spC, int species, u8 gender, u8 switch (species) { case SPECIES_BURMY: - if (forme > 2) - forme = 0; + if (form > 2) + form = 0; spC->unk0 = NARC_POKETOOL_POKEGRA_OTHERPOKE; - spC->unk2 = (u16)(sp10 / 2 + 0x48 + forme * 2); - spC->unk4 = (u16)(shiny + 0x92 + forme * 2); + spC->unk2 = (u16)(sp10 / 2 + 0x48 + form * 2); + spC->unk4 = (u16)(shiny + 0x92 + form * 2); break; case SPECIES_WORMADAM: - if (forme > 2) - forme = 0; + if (form > 2) + form = 0; spC->unk0 = NARC_POKETOOL_POKEGRA_OTHERPOKE; - spC->unk2 = (u16)(sp10 / 2 + 0x4E + forme * 2); - spC->unk4 = (u16)(shiny + 0x98 + forme * 2); + spC->unk2 = (u16)(sp10 / 2 + 0x4E + form * 2); + spC->unk4 = (u16)(shiny + 0x98 + form * 2); break; case SPECIES_SHELLOS: - if (forme > 1) - forme = 0; + if (form > 1) + form = 0; spC->unk0 = NARC_POKETOOL_POKEGRA_OTHERPOKE; - spC->unk2 = (u16)(sp10 + 0x54 + forme); - spC->unk4 = (u16)(shiny + 0x9E + forme * 2); + spC->unk2 = (u16)(sp10 + 0x54 + form); + spC->unk4 = (u16)(shiny + 0x9E + form * 2); break; case SPECIES_GASTRODON: - if (forme > 1) - forme = 0; + if (form > 1) + form = 0; spC->unk0 = NARC_POKETOOL_POKEGRA_OTHERPOKE; - spC->unk2 = (u16)(sp10 + 0x58 + forme); - spC->unk4 = (u16)(shiny + 0xA2 + forme * 2); + spC->unk2 = (u16)(sp10 + 0x58 + form); + spC->unk4 = (u16)(shiny + 0xA2 + form * 2); break; case SPECIES_CHERRIM: - if (forme > 1) - forme = 0; + if (form > 1) + form = 0; spC->unk0 = NARC_POKETOOL_POKEGRA_OTHERPOKE; - spC->unk2 = (u16)(sp10 + 0x5C + forme); - spC->unk4 = (u16)(shiny * 2 + 0xA6 + forme); + spC->unk2 = (u16)(sp10 + 0x5C + form); + spC->unk4 = (u16)(shiny * 2 + 0xA6 + form); break; case SPECIES_ARCEUS: - if (forme > 17) - forme = 0; + if (form > 17) + form = 0; spC->unk0 = NARC_POKETOOL_POKEGRA_OTHERPOKE; - spC->unk2 = (u16)(sp10 / 2 + 0x60 + forme * 2); - spC->unk4 = (u16)(shiny + 0xAA + forme * 2); + spC->unk2 = (u16)(sp10 / 2 + 0x60 + form * 2); + spC->unk4 = (u16)(shiny + 0xAA + form * 2); break; case SPECIES_CASTFORM: - if (forme > 3) - forme = 0; + if (form > 3) + form = 0; spC->unk0 = NARC_POKETOOL_POKEGRA_OTHERPOKE; - spC->unk2 = (u16)(sp10 * 2 + 0x40 + forme); - spC->unk4 = (u16)(shiny * 4 + 0x8A + forme); + spC->unk2 = (u16)(sp10 * 2 + 0x40 + form); + spC->unk4 = (u16)(shiny * 4 + 0x8A + form); break; case SPECIES_DEOXYS: - if (forme > 3) - forme = 0; + if (form > 3) + form = 0; spC->unk0 = NARC_POKETOOL_POKEGRA_OTHERPOKE; - spC->unk2 = (u16)(sp10 / 2 + forme * 2); + spC->unk2 = (u16)(sp10 / 2 + form * 2); spC->unk4 = (u16)(shiny + 0x86); break; case SPECIES_UNOWN: - if (forme >= 28) - forme = 0; + if (form >= 28) + form = 0; spC->unk0 = NARC_POKETOOL_POKEGRA_OTHERPOKE; - spC->unk2 = (u16)(sp10 / 2 + 0x8 + forme * 2); + spC->unk2 = (u16)(sp10 / 2 + 0x8 + form * 2); spC->unk4 = (u16)(shiny + 0x88); break; case SPECIES_EGG: - if (forme > 1) - forme = 0; + if (form > 1) + form = 0; spC->unk0 = NARC_POKETOOL_POKEGRA_OTHERPOKE; - spC->unk2 = (u16)(0x84 + forme); - spC->unk4 = (u16)(0xCE + forme); + spC->unk2 = (u16)(0x84 + form); + spC->unk4 = (u16)(0xCE + form); break; case SPECIES_MANAPHY_EGG: spC->unk0 = NARC_POKETOOL_POKEGRA_OTHERPOKE; @@ -2303,20 +2303,20 @@ u8 sub_02068E1C(struct BoxPokemon * boxmon, u32 a1) u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES2, NULL); u8 gender = GetBoxMonGender(boxmon); u32 pid = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL); - u8 forme; + u8 form; if (species == SPECIES_EGG) { if (GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL) == SPECIES_MANAPHY) - forme = 1; + form = 1; else - forme = 0; + form = 0; } else - forme = (u8)GetBoxMonData(boxmon, MON_DATA_FORME, NULL); - return sub_02068E88(species, gender, a1, forme, pid); + form = (u8)GetBoxMonData(boxmon, MON_DATA_FORM, NULL); + return sub_02068E88(species, gender, a1, form, pid); } -u8 sub_02068E88(int species, u8 gender, u32 a1, u8 forme, u32 pid) +u8 sub_02068E88(int species, u8 gender, u32 a1, u8 form, u32 pid) { #pragma unused(pid) u8 ret; @@ -2325,64 +2325,64 @@ u8 sub_02068E88(int species, u8 gender, u32 a1, u8 forme, u32 pid) switch (species) { case SPECIES_BURMY: - if (forme > 2) - forme = 0; + if (form > 2) + form = 0; narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; - fileId = (s32)(a1 / 2 + 0x48 + forme * 2); + fileId = (s32)(a1 / 2 + 0x48 + form * 2); break; case SPECIES_WORMADAM: - if (forme > 2) - forme = 0; + if (form > 2) + form = 0; narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; - fileId = (s32)(a1 / 2 + 0x4E + forme * 2); + fileId = (s32)(a1 / 2 + 0x4E + form * 2); break; case SPECIES_SHELLOS: - if (forme > 1) - forme = 0; + if (form > 1) + form = 0; narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; - fileId = (s32)(a1 + 0x54 + forme); + fileId = (s32)(a1 + 0x54 + form); break; case SPECIES_GASTRODON: - if (forme > 1) - forme = 0; + if (form > 1) + form = 0; narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; - fileId = (s32)(a1 + 0x58 + forme); + fileId = (s32)(a1 + 0x58 + form); break; case SPECIES_CHERRIM: - if (forme > 1) - forme = 0; + if (form > 1) + form = 0; narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; - fileId = (s32)(a1 + 0x5C + forme); + fileId = (s32)(a1 + 0x5C + form); break; case SPECIES_ARCEUS: - if (forme > 17) - forme = 0; + if (form > 17) + form = 0; narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; - fileId = (s32)(a1 / 2 + 0x60 + 2 * forme); + fileId = (s32)(a1 / 2 + 0x60 + 2 * form); break; case SPECIES_CASTFORM: - if (forme > 3) - forme = 0; + if (form > 3) + form = 0; narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; - fileId = (s32)(a1 * 2 + 0x40 + forme); + fileId = (s32)(a1 * 2 + 0x40 + form); break; case SPECIES_DEOXYS: - if (forme > 3) - forme = 0; + if (form > 3) + form = 0; narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; - fileId = (s32)(a1 / 2 + forme * 2); + fileId = (s32)(a1 / 2 + form * 2); break; case SPECIES_UNOWN: - if (forme >= 28) - forme = 0; + if (form >= 28) + form = 0; narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; - fileId = (s32)(a1 / 2 + 0x8 + forme * 2); + fileId = (s32)(a1 / 2 + 0x8 + form * 2); break; case SPECIES_EGG: - if (forme > 1) - forme = 0; + if (form > 1) + form = 0; narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; - fileId = (s32)(0x84 + forme); + fileId = (s32)(0x84 + form); break; case SPECIES_MANAPHY_EGG: narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; @@ -2468,7 +2468,7 @@ u8 GetMonUnownLetter(struct Pokemon * pokemon) //not just used for unown u8 GetBoxMonUnownLetter(struct BoxPokemon * boxmon) { - return (u8)GetBoxMonData(boxmon, MON_DATA_FORME, NULL); + return (u8)GetBoxMonData(boxmon, MON_DATA_FORM, NULL); } struct BoxPokemon * sub_020690E4(struct Pokemon * pokemon) @@ -2792,15 +2792,15 @@ void InitBoxMonMoveset(struct BoxPokemon * boxmon) u16 * wotbl; int i; u16 species; - u32 forme; + u32 form; u8 level; u16 move; wotbl = AllocFromHeap(HEAP_ID_DEFAULT, 22 * sizeof(u16)); decry = AcquireBoxMonLock(boxmon); species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); - forme = GetBoxMonData(boxmon, MON_DATA_FORME, NULL); + form = GetBoxMonData(boxmon, MON_DATA_FORM, NULL); level = (u8)CalcBoxMonLevel(boxmon); - LoadWotbl_HandleAlternateForme(species, (int)forme, wotbl); + LoadWotbl_HandleAlternateForm(species, (int)form, wotbl); for (i = 0; wotbl[i] != WOTBL_END; i++) { if ((wotbl[i] & WOTBL_LVL_MASK) > (level << WOTBL_LVL_SHIFT)) @@ -2898,9 +2898,9 @@ u32 sub_02069818(struct Pokemon * pokemon, u32 * r5, u16 * sp0) u32 ret = 0; u16 * wotbl = AllocFromHeap(HEAP_ID_DEFAULT, 22 * sizeof(u16)); u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL); - u32 forme = GetMonData(pokemon, MON_DATA_FORME, NULL); + u32 form = GetMonData(pokemon, MON_DATA_FORM, NULL); u8 level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, NULL); - LoadWotbl_HandleAlternateForme(species, (int)forme, wotbl); + LoadWotbl_HandleAlternateForm(species, (int)form, wotbl); if (wotbl[*r5] == 0xFFFF) @@ -3075,11 +3075,11 @@ s8 GetFlavorPreferenceFromPID(u32 personality, int flavor) return sFlavorPreferencesByNature[GetNatureFromPersonality(personality)][flavor]; } -int Species_LoadLearnsetTable(u16 species, u32 forme, u16 * dest) +int Species_LoadLearnsetTable(u16 species, u32 form, u16 * dest) { int i; u16 * wotbl = AllocFromHeap(HEAP_ID_DEFAULT, 22 * sizeof(u16)); - LoadWotbl_HandleAlternateForme(species, (int)forme, wotbl); + LoadWotbl_HandleAlternateForm(species, (int)form, wotbl); for (i = 0; wotbl[i] != WOTBL_END; i++) { dest[i] = WOTBL_MOVE(wotbl[i]); @@ -3239,21 +3239,21 @@ BOOL BoxMon_IsImmuneToPokerus(struct BoxPokemon * boxmon) return FALSE; } -void Pokemon_UpdateArceusForme(struct Pokemon * pokemon) +void Pokemon_UpdateArceusForm(struct Pokemon * pokemon) { - BoxMon_UpdateArceusForme(&pokemon->box); + BoxMon_UpdateArceusForm(&pokemon->box); } -void BoxMon_UpdateArceusForme(struct BoxPokemon * boxmon) +void BoxMon_UpdateArceusForm(struct BoxPokemon * boxmon) { u32 species = GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); u32 ability = GetBoxMonData(boxmon, MON_DATA_ABILITY, NULL); u32 heldItem = GetBoxMonData(boxmon, MON_DATA_HELD_ITEM, NULL); - u32 forme; + u32 form; if (species == SPECIES_ARCEUS && ability == ABILITY_MULTITYPE) { - forme = GetArceusTypeByHeldItemEffect((u16)GetItemAttr((u16)heldItem, 1, HEAP_ID_DEFAULT)); - SetBoxMonData(boxmon, MON_DATA_FORME, &forme); + form = GetArceusTypeByHeldItemEffect((u16)GetItemAttr((u16)heldItem, 1, HEAP_ID_DEFAULT)); + SetBoxMonData(boxmon, MON_DATA_FORM, &form); } } @@ -3298,9 +3298,9 @@ u32 GetArceusTypeByHeldItemEffect(u16 heldEffect) } } -void LoadWotbl_HandleAlternateForme(int species, int forme, u16 * wotbl) +void LoadWotbl_HandleAlternateForm(int species, int form, u16 * wotbl) { - ReadWholeNarcMemberByIdPair(wotbl, NARC_POKETOOL_PERSONAL_WOTBL, ResolveMonForme(species, forme)); + ReadWholeNarcMemberByIdPair(wotbl, NARC_POKETOOL_PERSONAL_WOTBL, ResolveMonForm(species, form)); } void sub_02069FB0(struct SaveChatotSoundClip *r7, u32 r5, u16 r4, s32 r6, s32 sp18, u32 sp1C, HeapID heapId) @@ -3350,15 +3350,15 @@ void sub_0206A094(struct Pokemon * pokemon, u32 a1, u32 a2) { u32 chance; u16 species; - u16 forme; + u16 form; u16 item1; u16 item2; if (!(a1 & 0x81)) { chance = (u32)(LCRandom() % 100); species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, 0); - forme = (u16)GetMonData(pokemon, MON_DATA_FORME, 0); - item1 = (u16)GetMonBaseStat_HandleFormeConversion(species, forme, BASE_ITEM_1); - item2 = (u16)GetMonBaseStat_HandleFormeConversion(species, forme, BASE_ITEM_2); + form = (u16)GetMonData(pokemon, MON_DATA_FORM, 0); + item1 = (u16)GetMonBaseStat_HandleFormConversion(species, form, BASE_ITEM_1); + item2 = (u16)GetMonBaseStat_HandleFormConversion(species, form, BASE_ITEM_2); if (item1 == item2 && item1 != ITEM_NONE) { SetMonData(pokemon, MON_DATA_HELD_ITEM, &item1); @@ -3388,11 +3388,11 @@ BOOL sub_0206A13C(struct Pokemon * pokemon, u32 a1) BOOL sub_0206A144(struct BoxPokemon * boxmon, u32 a1) { u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES2, NULL); - int forme = (int)GetBoxMonData(boxmon, MON_DATA_FORME, NULL); - return sub_0206A16C(species, forme, a1); + int form = (int)GetBoxMonData(boxmon, MON_DATA_FORM, NULL); + return sub_0206A16C(species, form, a1); } -BOOL sub_0206A16C(u16 species, int forme, u32 a2) +BOOL sub_0206A16C(u16 species, int form, u32 a2) { u32 r4; enum BaseStat r2; @@ -3418,7 +3418,7 @@ BOOL sub_0206A16C(u16 species, int forme, u32 a2) r4 = 1ul << (a2 - 96); r2 = BASE_TMHM_4; } - return !!(GetMonBaseStat_HandleFormeConversion(species, forme, r2) & r4); + return !!(GetMonBaseStat_HandleFormConversion(species, form, r2) & r4); } void sub_0206A1C4(struct Pokemon * pokemon) @@ -3488,9 +3488,9 @@ void LoadMonPersonal(int species, struct BaseStats * personal) ReadWholeNarcMemberByIdPair(personal, NARC_POKETOOL_PERSONAL_PERSONAL, species); } -void LoadMonBaseStats_HandleAlternateForme(int species, int forme, struct BaseStats * personal) +void LoadMonBaseStats_HandleAlternateForm(int species, int form, struct BaseStats * personal) { - ReadWholeNarcMemberByIdPair(personal, NARC_POKETOOL_PERSONAL_PERSONAL, ResolveMonForme(species, forme)); + ReadWholeNarcMemberByIdPair(personal, NARC_POKETOOL_PERSONAL_PERSONAL, ResolveMonForm(species, form)); } void LoadMonEvolutionTable(u16 species, struct Evolution * evo) @@ -3616,17 +3616,17 @@ PokemonDataBlock *GetSubstruct(struct BoxPokemon *boxMon, u32 personality, u8 su return result; } -int ResolveMonForme(int species, int forme) +int ResolveMonForm(int species, int form) { switch (species) { case SPECIES_DEOXYS: - if (forme != 0 && forme <= 3) - return SPECIES_DEOXYS_ATK + forme - 1; + if (form != 0 && form <= 3) + return SPECIES_DEOXYS_ATK + form - 1; break; case SPECIES_WORMADAM: - if (forme != 0 && forme <= 2) - return SPECIES_WORMADAM_SANDY + forme - 1; + if (form != 0 && form <= 2) + return SPECIES_WORMADAM_SANDY + form - 1; break; } return species; diff --git a/arm9/src/poketch.c b/arm9/src/poketch.c index a4f80fa0b..d8df97ca5 100644 --- a/arm9/src/poketch.c +++ b/arm9/src/poketch.c @@ -3,7 +3,7 @@ #include "pokemon.h" #include "poketch.h" -extern u16 BoxMon_GetAlternateForme(struct BoxPokemon * mon); +extern u16 BoxMon_GetAlternateForm(struct BoxPokemon * mon); static const u8 sMarkingMapInitialPos[][2] = { { 0x68, 0x98 }, @@ -232,7 +232,7 @@ void Save_Poketch_PokemonHistoryAddMon(struct Poketch * poketch, struct BoxPokem i = 11; } poketch->pokemonHistory[i][0] = (u16)GetBoxMonData(mon, MON_DATA_SPECIES, NULL); - poketch->pokemonHistory[i][1] = BoxMon_GetAlternateForme(mon); + poketch->pokemonHistory[i][1] = BoxMon_GetAlternateForm(mon); } int Save_Poketch_PokemonHistoryGetFirstEmptySlot(struct Poketch * poketch) @@ -246,12 +246,12 @@ int Save_Poketch_PokemonHistoryGetFirstEmptySlot(struct Poketch * poketch) return i; } -void Save_Poketch_PokemonHistoryGetSlotN(struct Poketch * poketch, s32 i, u32 * species_p, u32 * forme_p) +void Save_Poketch_PokemonHistoryGetSlotN(struct Poketch * poketch, s32 i, u32 * species_p, u32 * form_p) { GF_ASSERT(i < 12); GF_ASSERT(poketch->pokemonHistory[i][0] != SPECIES_NONE); *species_p = poketch->pokemonHistory[i][0]; - *forme_p = poketch->pokemonHistory[i][1]; + *form_p = poketch->pokemonHistory[i][1]; } struct Poketch * Save_Poketch_Get(struct SaveData * save) diff --git a/arm9/src/scrcmd.c b/arm9/src/scrcmd.c index 582e7917c..5dc2fff6d 100644 --- a/arm9/src/scrcmd.c +++ b/arm9/src/scrcmd.c @@ -1934,7 +1934,7 @@ BOOL ScrCmd_GiveSeals(ScriptContext *ctx) { //0094 return FALSE; } -BOOL ScrCmd_GetPokemonForme(ScriptContext *ctx) { //0095 +BOOL ScrCmd_GetPokemonForm(ScriptContext *ctx) { //0095 u16 partyPosition = ScriptGetVar(ctx); u16 *variable = ScriptGetVarPointer(ctx); @@ -4133,8 +4133,8 @@ BOOL ScrCmd_CheckPokemonInParty(ScriptContext *ctx) { //0262 return TRUE; } -BOOL ScrCmd_SetDeoxysForme(ScriptContext *ctx) { //0263 - u16 forme = ScriptGetVar(ctx); +BOOL ScrCmd_SetDeoxysForm(ScriptContext *ctx) { //0263 + u16 form = ScriptGetVar(ctx); PlayerParty *playerParty = SaveArray_PlayerParty_Get(ctx->fieldSystem->saveData); s32 partyCount = GetPartyCount(playerParty); Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); @@ -4142,7 +4142,7 @@ BOOL ScrCmd_SetDeoxysForme(ScriptContext *ctx) { //0263 for (s32 i = 0; i < partyCount; i++) { Pokemon *mon = GetPartyMonByIndex(playerParty, i); if (GetMonData(mon, MON_DATA_SPECIES, NULL) == SPECIES_DEOXYS) { - SetMonData(mon, MON_DATA_FORME, &forme); + SetMonData(mon, MON_DATA_FORM, &form); CalcMonLevelAndStats(mon); Pokedex_SetMonCaughtFlag(pokedex, mon); } @@ -4151,7 +4151,7 @@ BOOL ScrCmd_SetDeoxysForme(ScriptContext *ctx) { //0263 } #ifdef NONMATCHING -BOOL ScrCmd_CheckBurmyFormes(ScriptContext *ctx) { //0264 +BOOL ScrCmd_CheckBurmyForms(ScriptContext *ctx) { //0264 u16 *var = ScriptGetVarPointer(ctx); PlayerParty *playerParty = SaveArray_PlayerParty_Get(ctx->fieldSystem->saveData); s32 partyCount = GetPartyCount(playerParty); @@ -4165,12 +4165,12 @@ BOOL ScrCmd_CheckBurmyFormes(ScriptContext *ctx) { //0264 BOOL hasMultiple; Pokemon *mon = GetPartyMonByIndex(playerParty, i); u32 species = GetMonData(mon, MON_DATA_SPECIES, NULL); - u32 forme = GetMonData(mon, MON_DATA_FORME, NULL); + u32 form = GetMonData(mon, MON_DATA_FORM, NULL); if (species == SPECIES_BURMY) { hasMultiple = FALSE; - unk0[i] = forme; + unk0[i] = form; for (j = 0; j < i; j++) { - if (unk0[j] == forme) { + if (unk0[j] == form) { hasMultiple = TRUE; } } @@ -4183,7 +4183,7 @@ BOOL ScrCmd_CheckBurmyFormes(ScriptContext *ctx) { //0264 return TRUE; } #else -asm BOOL ScrCmd_CheckBurmyFormes(ScriptContext *ctx) { +asm BOOL ScrCmd_CheckBurmyForms(ScriptContext *ctx) { push {r3-r7, lr} sub sp, #0x30 add r4, r0, #0x0 diff --git a/arm9/src/unk_0206B688.c b/arm9/src/unk_0206B688.c index f6df15ad8..f6298d08d 100644 --- a/arm9/src/unk_0206B688.c +++ b/arm9/src/unk_0206B688.c @@ -2,16 +2,16 @@ #include "pokemon.h" #include "unk_0206B688.h" -u16 BoxMon_GetAlternateForme(struct BoxPokemon * boxmon); -u32 sub_0206B6D4(u32 species, u32 is_egg, u32 forme); +u16 BoxMon_GetAlternateForm(struct BoxPokemon * boxmon); +u32 sub_0206B6D4(u32 species, u32 is_egg, u32 form); u32 sub_0206B688(struct BoxPokemon * boxmon) { BOOL decry = AcquireBoxMonLock(boxmon); u32 species = GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); u32 is_egg = GetBoxMonData(boxmon, MON_DATA_IS_EGG, NULL); - u32 forme = BoxMon_GetAlternateForme(boxmon); - u32 ret = sub_0206B6D4(species, is_egg, forme); + u32 form = BoxMon_GetAlternateForm(boxmon); + u32 ret = sub_0206B6D4(species, is_egg, form); ReleaseBoxMonLock(boxmon, decry); return ret; } @@ -21,7 +21,7 @@ u32 sub_0206B6C8(struct Pokemon * pokemon) return sub_0206B688(sub_020690E4(pokemon)); } -u32 sub_0206B6D4(u32 species, u32 is_egg, u32 forme) +u32 sub_0206B6D4(u32 species, u32 is_egg, u32 form) { if (is_egg == TRUE) { @@ -30,25 +30,25 @@ u32 sub_0206B6D4(u32 species, u32 is_egg, u32 forme) else return 501; } - if (forme != 0) + if (form != 0) { if (species == SPECIES_DEOXYS) - return 502 + forme; + return 502 + form; if (species == SPECIES_UNOWN) - return 506 + forme; + return 506 + form; if (species == SPECIES_BURMY) - return 533 + forme; + return 533 + form; if (species == SPECIES_WORMADAM) - return 535 + forme; + return 535 + form; if (species == SPECIES_SHELLOS) - return 537 + forme; + return 537 + form; if (species == SPECIES_GASTRODON) - return 538 + forme; + return 538 + form; } return (species <= SPECIES_ARCEUS ? species : 0) + 7; } -u16 BoxMon_GetAlternateForme(struct BoxPokemon * boxmon) +u16 BoxMon_GetAlternateForm(struct BoxPokemon * boxmon) { u32 species = GetBoxMonData(boxmon, MON_DATA_SPECIES2, NULL); switch (species) @@ -60,7 +60,7 @@ u16 BoxMon_GetAlternateForme(struct BoxPokemon * boxmon) case SPECIES_WORMADAM: case SPECIES_SHELLOS: case SPECIES_GASTRODON: - return (u16) GetBoxMonData(boxmon, MON_DATA_FORME, NULL); + return (u16) GetBoxMonData(boxmon, MON_DATA_FORM, NULL); default: return 0; } @@ -103,7 +103,7 @@ const u8 UNK_020F8074[] = { 0, 1, 0, 0, 0, 0, 0, 0 }; -u32 sub_0206B7BC(u32 species, u32 forme, u32 is_egg) +u32 sub_0206B7BC(u32 species, u32 form, u32 is_egg) { if (is_egg == TRUE) { @@ -114,20 +114,20 @@ u32 sub_0206B7BC(u32 species, u32 forme, u32 is_egg) } else if (species > SPECIES_ARCEUS) species = 0; - else if (forme != 0) + else if (form != 0) { if (species == SPECIES_DEOXYS) - species = 495 + forme; + species = 495 + form; else if (species == SPECIES_UNOWN) - species = 498 + forme; + species = 498 + form; else if (species == SPECIES_BURMY) - species = 526 + forme; + species = 526 + form; else if (species == SPECIES_WORMADAM) - species = 528 + forme; + species = 528 + form; else if (species == SPECIES_SHELLOS) - species = 530 + forme; + species = 530 + form; else if (species == SPECIES_GASTRODON) - species = 531 + forme; + species = 531 + form; } return UNK_020F8074[species]; } @@ -135,11 +135,11 @@ u32 sub_0206B7BC(u32 species, u32 forme, u32 is_egg) u32 sub_0206B83C(struct BoxPokemon * boxmon) { BOOL decry = AcquireBoxMonLock(boxmon); - u32 forme = BoxMon_GetAlternateForme(boxmon); + u32 form = BoxMon_GetAlternateForm(boxmon); u32 species = GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); u32 is_egg = GetBoxMonData(boxmon, MON_DATA_IS_EGG, NULL); ReleaseBoxMonLock(boxmon, decry); - return sub_0206B7BC(species, forme, is_egg); + return sub_0206B7BC(species, form, is_egg); } u32 sub_0206B87C(struct Pokemon * pokemon) diff --git a/arm9/src/unk_02088DD8.c b/arm9/src/unk_02088DD8.c index 5cc47e929..9b2495be3 100644 --- a/arm9/src/unk_02088DD8.c +++ b/arm9/src/unk_02088DD8.c @@ -3,7 +3,7 @@ #include "pokemon.h" #include "unk_02088DD8.h" -extern void LoadWotbl_HandleAlternateForme(int species, int forme, u16 * wotbl); +extern void LoadWotbl_HandleAlternateForm(int species, int form, u16 * wotbl); MoveRelearner *sub_02088DD8(HeapID heapId) { MoveRelearner *returnPointer = AllocFromHeap(heapId, sizeof(MoveRelearner)); @@ -26,7 +26,7 @@ void sub_02088DF0(MoveRelearner *moveRelearner) { u16* GetEligibleLevelUpMoves(struct Pokemon* pokemon, HeapID heapId) { u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, 0); - u8 forme = (u8)GetMonData(pokemon, MON_DATA_FORME, 0); + u8 form = (u8)GetMonData(pokemon, MON_DATA_FORM, 0); u8 level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, 0); u16 moves[4]; @@ -37,7 +37,7 @@ u16* GetEligibleLevelUpMoves(struct Pokemon* pokemon, HeapID heapId) { u16 *tableFromFile = AllocFromHeap(heapId, 44); u16 *returnTable = AllocFromHeap(heapId, 44); - LoadWotbl_HandleAlternateForme(species, forme, tableFromFile); + LoadWotbl_HandleAlternateForm(species, form, tableFromFile); for (u8 i = 0, j, k = 0; i < 22; i++) { if (tableFromFile[i] == WOTBL_END) { diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index fc156e382..e71bafbfe 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -225,7 +225,7 @@ #define MON_DATA_HOENN_WORLD_RIBBON 109 #define MON_DATA_FATEFUL_ENCOUNTER 110 #define MON_DATA_GENDER 111 -#define MON_DATA_FORME 112 +#define MON_DATA_FORM 112 #define MON_DATA_RESERVED_113 113 // HGSS #define MON_DATA_RESERVED_114 114 // Plat #define MON_DATA_UNUSED_115 115 @@ -448,7 +448,7 @@ typedef enum { UNOWN_Z = 25, UNOWN_EXCLAMATION_MARK = 26, UNOWN_QUESTION_MARK = 27 -} AlternateFormes; +} AlternateForms; typedef enum EvoMethod { diff --git a/include/hall_of_fame.h b/include/hall_of_fame.h index 7be679003..ade543d8a 100644 --- a/include/hall_of_fame.h +++ b/include/hall_of_fame.h @@ -9,7 +9,7 @@ struct HOFMon { /* 0x00 */ u16 species; /* 0x02 */ u8 level; - /* 0x03 */ u8 forme; + /* 0x03 */ u8 form; /* 0x04 */ u32 personality; /* 0x08 */ u32 otid; /* 0x0C */ u16 nickname[POKEMON_NAME_LENGTH + 1]; @@ -41,7 +41,7 @@ struct HofDisplayMon u32 otid; u16 species; u8 level; - u8 forme; + u8 form; u16 moves[4]; }; diff --git a/include/pokedex.h b/include/pokedex.h index 9aa06bb7f..7c80510af 100644 --- a/include/pokedex.h +++ b/include/pokedex.h @@ -9,9 +9,9 @@ typedef struct Pokedex { /* 0x0000 */ u32 magic; // BEEFCAFE /* 0x0004 */ u8 caughtFlags[0x3C]; - /* 0x0040 */ u32 caughtFlagsHi_Deoxys1; // Deoxys forme plus top 13 dex flags + /* 0x0040 */ u32 caughtFlagsHi_Deoxys1; // Deoxys form plus top 13 dex flags /* 0x0044 */ u8 seenFlags[0x3C]; - /* 0x0080 */ u32 seenFlagsHi_Deoxys2; // Deoxys forme plus top 13 dex flags + /* 0x0080 */ u32 seenFlagsHi_Deoxys2; // Deoxys form plus top 13 dex flags /* 0x0084 */ u8 field_0084[0x40]; // Genders /* 0x00C4 */ u8 field_00C4[0x40]; // Genders /* 0x0104 */ u32 spindaPersonality; // spinda personality @@ -30,17 +30,17 @@ u32 Save_Pokedex_sizeof(void); struct Pokedex * Save_Pokedex_New(HeapID heapId); void Save_Pokedex_Copy(const struct Pokedex * src, struct Pokedex * dest); s32 Pokedex_CountSeenShellosOrGastrodon_Internal(struct Pokedex * pokedex, u32 species); -BOOL Pokedex_HasSeenShellosOrGastrodonForme(struct Pokedex * pokedex, u32 species, u8 state); -void Pokedex_SetSeenShellosOrGastrodonForme(struct Pokedex * pokedex, u32 species, u32 state); +BOOL Pokedex_HasSeenShellosOrGastrodonForm(struct Pokedex * pokedex, u32 species, u8 state); +void Pokedex_SetSeenShellosOrGastrodonForm(struct Pokedex * pokedex, u32 species, u32 state); s32 Pokedex_CountSeenBurmyOrWormadam_Internal(struct Pokedex * pokedex, u32 species); -BOOL Pokedex_HasSeenBurmyOrWormadamForme(struct Pokedex * pokedex, u32 species, u8 state); -void Pokedex_SetSeenBurmyOrWormadamForme(struct Pokedex * pokedex, u32 species, s32 state); -void Pokedex_SetSeenDeoxysFormeAt(struct Pokedex * pokedex, u8 r4, u8 r6); -s32 Pokedex_CountSeenDeoxysFormes_Internal(struct Pokedex * pokedex); -BOOL Pokedex_HasSeenDeoxysForme(struct Pokedex * pokedex, u32 state); -void Pokedex_TrySetSeenDeoxysForme(struct Pokedex * pokedex, u16 species, struct Pokemon * pokemon); -void Pokedex_InitSeenDeoxysFormesArray(struct Pokedex * pokedex); -void Pokedex_SetMonSeenForme(struct Pokedex * pokedex, u16 species, struct Pokemon * pokemon); +BOOL Pokedex_HasSeenBurmyOrWormadamForm(struct Pokedex * pokedex, u32 species, u8 state); +void Pokedex_SetSeenBurmyOrWormadamForm(struct Pokedex * pokedex, u32 species, s32 state); +void Pokedex_SetSeenDeoxysFormAt(struct Pokedex * pokedex, u8 r4, u8 r6); +s32 Pokedex_CountSeenDeoxysForms_Internal(struct Pokedex * pokedex); +BOOL Pokedex_HasSeenDeoxysForm(struct Pokedex * pokedex, u32 state); +void Pokedex_TrySetSeenDeoxysForm(struct Pokedex * pokedex, u16 species, struct Pokemon * pokemon); +void Pokedex_InitSeenDeoxysFormsArray(struct Pokedex * pokedex); +void Pokedex_SetMonSeenForm(struct Pokedex * pokedex, u16 species, struct Pokemon * pokemon); void Pokedex_SetMeisterFlagBySpeciesAndLanguage(struct Pokedex * pokedex, u32 species, u32 language); s32 sub_020242C8(struct Pokedex * pokedex, u16 species, s32 r4); BOOL Pokedex_SpeciesIsNotMythical(u16 species); @@ -61,15 +61,15 @@ u32 Pokedex_GetSeenSpindaPersonality(struct Pokedex * pokedex, u32 a1); s32 sub_02024674(struct Pokedex * pokedex, u16 species, s32 r6); s32 Pokedex_GetSeenUnownI(struct Pokedex * pokedex, s32 a1); s32 Pokedex_CountSeenUnown(struct Pokedex * pokedex); -BOOL Pokedex_GetSeenShellosForme(struct Pokedex * pokedex, s32 a1); +BOOL Pokedex_GetSeenShellosForm(struct Pokedex * pokedex, s32 a1); s32 Pokedex_CountSeenShellos(struct Pokedex * pokedex); -BOOL Pokedex_GetSeenGastrodonForme(struct Pokedex * pokedex, s32 a1); +BOOL Pokedex_GetSeenGastrodonForm(struct Pokedex * pokedex, s32 a1); s32 Pokedex_CountSeenGastrodon(struct Pokedex * pokedex); -s32 Pokedex_GetSeenBurmyForme(struct Pokedex * pokedex, s32 a1); +s32 Pokedex_GetSeenBurmyForm(struct Pokedex * pokedex, s32 a1); s32 Pokedex_CountSeenBurmy(struct Pokedex * pokedex); -s32 Pokedex_GetSeenWormadamForme(struct Pokedex * pokedex, s32 a1); +s32 Pokedex_GetSeenWormadamForm(struct Pokedex * pokedex, s32 a1); s32 Pokedex_CountSeenWormadam(struct Pokedex * pokedex); -s32 Pokedex_GetSeenDeoxysForme(struct Pokedex * pokedex, s32 a1); +s32 Pokedex_GetSeenDeoxysForm(struct Pokedex * pokedex, s32 a1); s32 Pokedex_CountSeenDeoxys(struct Pokedex * pokedex); void Pokedex_SetMonSeenFlag(struct Pokedex * pokedex, struct Pokemon * pokemon); void Pokedex_SetMonCaughtFlag(struct Pokedex * pokedex, struct Pokemon * pokemon); @@ -83,6 +83,6 @@ BOOL Pokedex_GetForeignEntriesFlag(struct Pokedex * pokedex); BOOL Pokedex_GetSinnohDexFlag(struct Pokedex * pokedex); void Pokedex_SetSinnohDexFlag(struct Pokedex * pokedex); struct Pokedex * Save_Pokedex_Get(struct SaveData * save); -s32 Pokedex_GetSeenMonForme(struct Pokedex * pokedex, s32 a1, u32 a2); +s32 Pokedex_GetSeenMonForm(struct Pokedex * pokedex, s32 a1, u32 a2); #endif //POKEDIAMOND_POKEDEX_H diff --git a/include/pokemon.h b/include/pokemon.h index 29d590c9f..25a3347dc 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -85,7 +85,7 @@ typedef struct { /* 0x10 */ u32 hpIV:5, atkIV:5, defIV:5, spdIV:5, spatkIV:5, spdefIV:5, isEgg:1, isNicknamed:1; // TODO: Finish HoennRibbonSet /* 0x14 */ u32 ribbonFlags; // cool, ... - /* 0x18 */ u8 fatefulEncounter:1, gender:2, alternateForme:5; + /* 0x18 */ u8 fatefulEncounter:1, gender:2, alternateForm:5; /* 0x19 */ u8 HGSS_shinyLeaves; // TODO: Turn into bitfield /* 0x1A */ u16 Unused; /* 0x1C */ u16 Platinum_EggLocation; @@ -229,7 +229,7 @@ void AddMonData(struct Pokemon * pokemon, int attr, int amount); struct BaseStats * AllocAndLoadMonPersonal(int species, HeapID heapId); int GetPersonalAttr(struct BaseStats * baseStats, enum BaseStat attr); void FreeMonPersonal(struct BaseStats * personal); -int GetMonBaseStat_HandleFormeConversion(int species, int forme, enum BaseStat stat_id); +int GetMonBaseStat_HandleFormConversion(int species, int form, enum BaseStat stat_id); int GetMonBaseStat(int species, enum BaseStat stat_id); u8 GetPercentProgressTowardsNextLevel(struct Pokemon * pokemon); u32 CalcMonExpToNextLevel(struct Pokemon * pokemon); @@ -251,10 +251,10 @@ u8 GetGenderBySpeciesAndPersonality(u16 species, u32 pid); u8 MonIsShiny(struct Pokemon * pokemon); u32 GenerateShinyPersonality(u32 otid); void sub_02068B70(struct SomeDrawPokemonStruct * spC, struct BoxPokemon * boxmon, u8 sp10); -void sub_02068C00(struct SomeDrawPokemonStruct * spC, int species, u8 gender, u8 sp10, u8 shiny, u8 forme, u32 personality); +void sub_02068C00(struct SomeDrawPokemonStruct * spC, int species, u8 gender, u8 sp10, u8 shiny, u8 form, u32 personality); u8 sub_02068E14(struct Pokemon * pokemon, u32 a1); u8 sub_02068E1C(struct BoxPokemon * boxmon, u32 a1); -u8 sub_02068E88(int species, u8 gender, u32 a2, u8 forme, u32 pid); +u8 sub_02068E88(int species, u8 gender, u32 a2, u8 form, u32 pid); u32 GetArceusTypeByHeldItemEffect(u16 plate); int sub_0206AA30(int a0); void sub_02068B68(struct SomeDrawPokemonStruct * spC, struct Pokemon * pokemon, u8 sp10); @@ -288,13 +288,13 @@ void CopyPokemonToPokemon(struct Pokemon * src, struct Pokemon * dest); void CopyPokemonToBoxPokemon(struct Pokemon * src, struct BoxPokemon * dest); void CopyBoxPokemonToBoxPokemon(struct BoxPokemon * src, struct BoxPokemon * dest); s8 MonGetFlavorPreference(struct Pokemon * pokemon, int flavor); -int Species_LoadLearnsetTable(u16 species, u32 forme, u16 * dest); +int Species_LoadLearnsetTable(u16 species, u32 form, u16 * dest); void Party_GivePokerusAtRandom(struct PlayerParty * party); void Party_UpdatePokerus(struct PlayerParty * party, int r5); void Party_SpreadPokerus(struct PlayerParty * party); BOOL Pokemon_HasPokerus(struct Pokemon * pokemon); BOOL Pokemon_IsImmuneToPokerus(struct Pokemon * pokemon); -void Pokemon_UpdateArceusForme(struct Pokemon * pokemon); +void Pokemon_UpdateArceusForm(struct Pokemon * pokemon); void sub_02069FB0(struct SaveChatotSoundClip *r7, u32 r5, u16 r4, s32 r6, s32 sp18, u32 sp1C, HeapID heapId); void sub_0206A014(struct Pokemon * pokemon, PlayerProfile * a1, u32 pokeball, u32 a3, u32 encounterType, HeapID heapId); void sub_0206A094(struct Pokemon * pokemon, u32 a1, u32 a2); diff --git a/include/poketch.h b/include/poketch.h index 1de28f126..7b10f5207 100644 --- a/include/poketch.h +++ b/include/poketch.h @@ -89,7 +89,7 @@ void Save_Poketch_DotArtistGetDrawing(struct Poketch * poketch, void * grid); void Save_Poketch_DotArtistSetDrawingAndEnable(struct Poketch * poketch, void * grid); void Save_Poketch_PokemonHistoryAddMon(struct Poketch * poketch, struct BoxPokemon * mon); int Save_Poketch_PokemonHistoryGetFirstEmptySlot(struct Poketch * poketch); -void Save_Poketch_PokemonHistoryGetSlotN(struct Poketch * poketch, s32 i, u32 * species_p, u32 * forme_p); +void Save_Poketch_PokemonHistoryGetSlotN(struct Poketch * poketch, s32 i, u32 * species_p, u32 * form_p); struct Poketch * Save_Poketch_Get(struct SaveData * save); #endif //POKEDIAMOND_POKETCH_H diff --git a/include/scrcmd.h b/include/scrcmd.h index ea0373392..4495340d1 100644 --- a/include/scrcmd.h +++ b/include/scrcmd.h @@ -147,7 +147,7 @@ BOOL ScrCmd_EventStopFollowing(ScriptContext *ctx); BOOL ScrCmd_Unk02AB(ScriptContext *ctx); BOOL ScrCmd_GetSealCountFromId(ScriptContext *ctx); BOOL ScrCmd_GiveSeals(ScriptContext *ctx); -BOOL ScrCmd_GetPokemonForme(ScriptContext *ctx); +BOOL ScrCmd_GetPokemonForm(ScriptContext *ctx); BOOL ScrCmd_ChoosePokemonMenu(ScriptContext *ctx); BOOL ScrCmd_OpenTradeScreen(ScriptContext *ctx); BOOL ScrCmd_UnionChoosePokemonMenu(ScriptContext *ctx); @@ -399,8 +399,8 @@ BOOL ScrCmd_Unk025E(ScriptContext *ctx); BOOL ScrCmd_Unk025F(ScriptContext *ctx); BOOL ScrCmd_AddSpecialGameStat(ScriptContext *ctx); BOOL ScrCmd_CheckPokemonInParty(ScriptContext *ctx); -BOOL ScrCmd_SetDeoxysForme(ScriptContext *ctx); -BOOL ScrCmd_CheckBurmyFormes(ScriptContext *ctx); +BOOL ScrCmd_SetDeoxysForm(ScriptContext *ctx); +BOOL ScrCmd_CheckBurmyForms(ScriptContext *ctx); // scrcmd_mart.c BOOL ScrCmd_NormalMart(ScriptContext *ctx); diff --git a/include/unk_0206B688.h b/include/unk_0206B688.h index 5c5ed0d27..8e36e5762 100644 --- a/include/unk_0206B688.h +++ b/include/unk_0206B688.h @@ -5,9 +5,9 @@ u32 sub_0206B688(struct BoxPokemon * boxmon); u32 sub_0206B6C8(struct Pokemon * pokemon); -u32 sub_0206B6D4(u32 species, u32 is_egg, u32 forme); -u16 BoxMon_GetAlternateForme(struct BoxPokemon * boxmon); -u32 sub_0206B7BC(u32 species, u32 forme, u32 is_egg); +u32 sub_0206B6D4(u32 species, u32 is_egg, u32 form); +u16 BoxMon_GetAlternateForm(struct BoxPokemon * boxmon); +u32 sub_0206B7BC(u32 species, u32 form, u32 is_egg); u32 sub_0206B83C(struct BoxPokemon * boxmon); u32 sub_0206B87C(struct Pokemon * pokemon); u32 sub_0206B888(void); From 9811df246a32d7d46b13e369e395c241e0cb322c Mon Sep 17 00:00:00 2001 From: red031000 Date: Thu, 29 Jun 2023 21:34:42 +0100 Subject: [PATCH 2/7] formd -> formed --- arm9/asm/NNS_G2D_g2d_renderer.s | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/arm9/asm/NNS_G2D_g2d_renderer.s b/arm9/asm/NNS_G2D_g2d_renderer.s index 3d193baf6..5cd5eaac5 100644 --- a/arm9/asm/NNS_G2D_g2d_renderer.s +++ b/arm9/asm/NNS_G2D_g2d_renderer.s @@ -3,8 +3,8 @@ .section .data - .global firstSRTransformdMtxIdx_ -firstSRTransformdMtxIdx_: ; 0x02106570 + .global firstSRTransformedMtxIdx_ +firstSRTransformedMtxIdx_: ; 0x02106570 .short -2 .balign 4, 0 @@ -111,7 +111,7 @@ NNS_G2dRotZ: ; 0x020B2794 ldr r0, [r0, #0x0] cmp r0, #0x0 bne _020B2824 - ldr r1, _020B28A4 ; =firstSRTransformdMtxIdx_ + ldr r1, _020B28A4 ; =firstSRTransformedMtxIdx_ ldr r0, _020B28A8 ; =0x0000FFFE ldrh r1, [r1, #0x0] cmp r1, r0 @@ -122,7 +122,7 @@ _020B2824: _020B2828: cmp r0, #0x0 ldreq r1, _020B2894 ; =stackPos_ - ldreq r0, _020B28A4 ; =firstSRTransformdMtxIdx_ + ldreq r0, _020B28A4 ; =firstSRTransformedMtxIdx_ ldreq r1, [r1, #0x0] streqh r1, [r0, #0x0] ldr r0, _020B2894 ; =stackPos_ @@ -155,7 +155,7 @@ _020B2894: .word stackPos_ _020B2898: .word mtxStack_ _020B289C: .word mtxStackFor2DHW_ _020B28A0: .word bDonotUseSRTransform -_020B28A4: .word firstSRTransformdMtxIdx_ +_020B28A4: .word firstSRTransformedMtxIdx_ _020B28A8: .word 0x0000FFFE _020B28AC: .word mtxStateStack_ _020B28B0: .word groupID_ @@ -206,7 +206,7 @@ NNS_G2dScale: ; 0x020B28B4 ldr r0, [r0, #0x0] cmp r0, #0x0 bne _020B2978 - ldr r1, _020B29F8 ; =firstSRTransformdMtxIdx_ + ldr r1, _020B29F8 ; =firstSRTransformedMtxIdx_ ldr r0, _020B29FC ; =0x0000FFFE ldrh r1, [r1, #0x0] cmp r1, r0 @@ -217,7 +217,7 @@ _020B2978: _020B297C: cmp r0, #0x0 ldreq r1, _020B29E8 ; =stackPos_ - ldreq r0, _020B29F8 ; =firstSRTransformdMtxIdx_ + ldreq r0, _020B29F8 ; =firstSRTransformedMtxIdx_ ldreq r1, [r1, #0x0] streqh r1, [r0, #0x0] ldr r0, _020B29E8 ; =stackPos_ @@ -250,7 +250,7 @@ _020B29E8: .word stackPos_ _020B29EC: .word mtxStack_ _020B29F0: .word mtxStackFor2DHW_ _020B29F4: .word bDonotUseSRTransform -_020B29F8: .word firstSRTransformdMtxIdx_ +_020B29F8: .word firstSRTransformedMtxIdx_ _020B29FC: .word 0x0000FFFE _020B2A00: .word mtxStateStack_ _020B2A04: .word groupID_ @@ -336,7 +336,7 @@ NNS_G2dPopMtx: ; 0x020B2B08 cmp r0, #0x0 bxne lr ldr r1, _020B2B4C ; =stackPos_ - ldr r0, _020B2B50 ; =firstSRTransformdMtxIdx_ + ldr r0, _020B2B50 ; =firstSRTransformedMtxIdx_ ldr r3, [r1, #0x0] ldrh r2, [r0, #0x0] sub r3, r3, #0x1 @@ -347,7 +347,7 @@ NNS_G2dPopMtx: ; 0x020B2B08 bx lr .balign 4 _020B2B4C: .word stackPos_ -_020B2B50: .word firstSRTransformdMtxIdx_ +_020B2B50: .word firstSRTransformedMtxIdx_ _020B2B54: .word 0x0000FFFE arm_func_end NNS_G2dPopMtx @@ -863,7 +863,7 @@ NNS_G2dBeginRendering: ; 0x020B326C ldr r2, _020B3314 ; =stackPos_ mov r4, #0x0 ldr r7, _020B3318 ; =0x0000FFFE - ldr r1, _020B331C ; =firstSRTransformdMtxIdx_ + ldr r1, _020B331C ; =firstSRTransformedMtxIdx_ str r0, [r3, #0x0] str r4, [r2, #0x0] strh r7, [r1, #0x0] @@ -903,7 +903,7 @@ _020B330C: .word currentMtxCachePos_ _020B3310: .word pCurrentInstance_ _020B3314: .word stackPos_ _020B3318: .word 0x0000FFFE -_020B331C: .word firstSRTransformdMtxIdx_ +_020B331C: .word firstSRTransformedMtxIdx_ _020B3320: .word mtxCacheBuffer_ _020B3324: .word groupID_ _020B3328: .word mtxStateStack_ @@ -967,7 +967,7 @@ NNS_G2dInitRenderer: ; 0x020B33A0 ldr r1, _020B3454 ; =stackPos_ strh r7, [r4, #0x94] ldr r2, _020B3458 ; =0x0000FFFE - ldr r0, _020B345C ; =firstSRTransformdMtxIdx_ + ldr r0, _020B345C ; =firstSRTransformedMtxIdx_ ldr r6, _020B3460 ; =mtxCacheBuffer_ str r7, [r1, #0x0] strh r2, [r0, #0x0] @@ -998,7 +998,7 @@ _020B3400: .balign 4 _020B3454: .word stackPos_ _020B3458: .word 0x0000FFFE -_020B345C: .word firstSRTransformdMtxIdx_ +_020B345C: .word firstSRTransformedMtxIdx_ _020B3460: .word mtxCacheBuffer_ _020B3464: .word currentMtxCachePos_ _020B3468: .word groupID_ @@ -1193,7 +1193,7 @@ DrawCellImpl_: ; 0x020B36C0 ldr r0, [r0, #0x0] cmp r0, #0x0 bne _020B3720 - ldr r2, _020B3B5C ; =firstSRTransformdMtxIdx_ + ldr r2, _020B3B5C ; =firstSRTransformedMtxIdx_ ldr r0, _020B3B60 ; =0x0000FFFE ldrh r2, [r2, #0x0] cmp r2, r0 @@ -1354,7 +1354,7 @@ _020B3908: ldr r0, [r0, #0x0] cmp r0, #0x0 bne _020B3978 - ldr r0, _020B3B5C ; =firstSRTransformdMtxIdx_ + ldr r0, _020B3B5C ; =firstSRTransformedMtxIdx_ ldrh r2, [r0, #0x0] ldr r0, _020B3B60 ; =0x0000FFFE cmp r2, r0 @@ -1494,7 +1494,7 @@ _020B3B40: .balign 4 _020B3B54: .word pCurrentInstance_ _020B3B58: .word bDonotUseSRTransform -_020B3B5C: .word firstSRTransformdMtxIdx_ +_020B3B5C: .word firstSRTransformedMtxIdx_ _020B3B60: .word 0x0000FFFE _020B3B64: .word mcRenderState_ _020B3B68: .word mcRenderState_ + 0x4 From e4c1bde3e7f1664aee53a403cfa30320d8a52bcd Mon Sep 17 00:00:00 2001 From: red031000 Date: Fri, 30 Jun 2023 00:59:37 +0100 Subject: [PATCH 3/7] libc to MSL_C --- Makefile | 6 +++--- arm9/CMakeLists.txt | 2 +- arm9/Makefile | 14 +++++++------- arm9/lib/{libc => MSL_C}/Makefile | 2 +- arm9/lib/{libc => MSL_C}/include/MSL.h | 0 .../lib/{libc => MSL_C}/include/MSL_Common_arith.h | 0 arm9/lib/{libc => MSL_C}/include/MSL_Common_rand.h | 0 arm9/lib/{libc => MSL_C}/include/ansi_params.h | 0 arm9/lib/{libc => MSL_C}/include/size_t.h | 0 arm9/lib/{libc => MSL_C}/include/string.h | 0 arm9/lib/{libc => MSL_C}/src/MSL_Common_arith.c | 0 arm9/lib/{libc => MSL_C}/src/MSL_Common_rand.c | 0 arm9/lib/Makefile | 8 ++++---- arm9/lib/NitroSDK/Makefile | 2 +- arm9/lib/libnns/Makefile | 2 +- m2ctx.sh | 2 +- 16 files changed, 19 insertions(+), 19 deletions(-) rename arm9/lib/{libc => MSL_C}/Makefile (87%) rename arm9/lib/{libc => MSL_C}/include/MSL.h (100%) rename arm9/lib/{libc => MSL_C}/include/MSL_Common_arith.h (100%) rename arm9/lib/{libc => MSL_C}/include/MSL_Common_rand.h (100%) rename arm9/lib/{libc => MSL_C}/include/ansi_params.h (100%) rename arm9/lib/{libc => MSL_C}/include/size_t.h (100%) rename arm9/lib/{libc => MSL_C}/include/string.h (100%) rename arm9/lib/{libc => MSL_C}/src/MSL_Common_arith.c (100%) rename arm9/lib/{libc => MSL_C}/src/MSL_Common_rand.c (100%) diff --git a/Makefile b/Makefile index 3f2d31f9e..2e5de7bba 100644 --- a/Makefile +++ b/Makefile @@ -104,7 +104,7 @@ OBJCOPY := $(CROSS)objcopy # ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o MWASFLAGS = -proc arm5te -MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -ipa file -fp soft -lang c99 -Cpp_exceptions off -i include -ir include-mw -ir arm9/lib/libc/include -ir arm9/lib/libnns/include -ir arm9/lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error +MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -ipa file -fp soft -lang c99 -Cpp_exceptions off -i include -ir include-mw -ir arm9/lib/MSL_C/include -ir arm9/lib/libnns/include -ir arm9/lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error MWLDFLAGS = -map -nodead -w off -proc v5te -interworking -map -symtab -m _start -msgstyle gcc ####################### Other Tools ######################### @@ -132,7 +132,7 @@ TOOLS = $(foreach tool,$(TOOLBASE),$(TOOLS_DIR)/$(tool)/$(tool)$(EXE)) TOOLS: tools export LM_LICENSE_FILE := $(TOOLS_DIR)/mwccarm/license.dat -export MWCIncludes := arm9/lib/libc/include arm9/lib/NitroSDK/include arm9/lib/libnns/include +export MWCIncludes := arm9/lib/MSL_C/include arm9/lib/NitroSDK/include arm9/lib/libnns/include export MWLibraries := arm9/lib ######################### Targets ########################### @@ -199,7 +199,7 @@ patch_mwasmarm: tools/mwasmarm_patcher ALL_DIRS := $(BUILD_DIR) ifeq (,$(NODEP)) -$(BUILD_DIR)/%.o: dep = $(shell $(SCANINC) -I include -I include-mw -I arm9/lib/libc/include -I arm9/lib/libnns/include -I arm9/lib/NitroSDK/include $(filter $*.c,$(C_FILES)) $(filter $*.cpp,$(CXX_FILES)) $(filter $*.s,$(S_FILES))) +$(BUILD_DIR)/%.o: dep = $(shell $(SCANINC) -I include -I include-mw -I arm9/lib/MSL_C/include -I arm9/lib/libnns/include -I arm9/lib/NitroSDK/include $(filter $*.c,$(C_FILES)) $(filter $*.cpp,$(CXX_FILES)) $(filter $*.s,$(S_FILES))) else $(BUILD_DIR)/%.o: dep := endif diff --git a/arm9/CMakeLists.txt b/arm9/CMakeLists.txt index 61882f1ed..226f67cda 100644 --- a/arm9/CMakeLists.txt +++ b/arm9/CMakeLists.txt @@ -15,5 +15,5 @@ file(GLOB_RECURSE SOURCES "*.c" "*.cpp" "*.s") file(GLOB OVERLAY_INC overlays/*/include) add_executable(DP_Arm9 ${SOURCES}) -target_include_directories(DP_Arm9 PRIVATE ../include ../include-mw lib/NitroSDK/include lib/libc/include lib/libnns/include ${OVERLAY_INC} ../files) +target_include_directories(DP_Arm9 PRIVATE ../include ../include-mw lib/NitroSDK/include lib/MSL_C/include lib/libnns/include ${OVERLAY_INC} ../files) target_compile_definitions(DP_Arm9 PUBLIC __CLION_IDE__) diff --git a/arm9/Makefile b/arm9/Makefile index 8fda63961..64f9a5d2b 100644 --- a/arm9/Makefile +++ b/arm9/Makefile @@ -57,10 +57,10 @@ LD_TEMPLATE := ARM9-TS.lcf.template # Directories containing source files # sorting wildcards required for versions of make >= 3.8.2 and < 4.3 for consistent builds -SRC_DIRS := src lib lib/libnns/src lib/NitroSDK/src lib/libc/src $(sort $(wildcard overlays/*/src)) +SRC_DIRS := src lib lib/libnns/src lib/NitroSDK/src lib/MSL_C/src $(sort $(wildcard overlays/*/src)) ASM_DIRS := asm data files $(sort $(wildcard overlays/*/asm)) LIBASM_DIRS := lib/syscall -INCLUDE_RECURSIVE_DIRS := ../include-mw lib/libc/include lib/libnns/include lib/NitroSDK/include +INCLUDE_RECURSIVE_DIRS := ../include-mw lib/MSL_C/include lib/libnns/include lib/NitroSDK/include INCLUDE_DIRS := ../include $(sort $(wildcard overlays/*/include)) ../files C_FILES := $(foreach dir,$(SRC_DIRS),$(sort $(wildcard $(dir)/*.c))) @@ -149,7 +149,7 @@ TOOLS = $(foreach tool,$(TOOLBASE),$(TOOLS_DIR)/$(tool)/$(tool)$(EXE)) TOOLS: tools export LM_LICENSE_FILE := $(TOOLS_DIR)/mwccarm/license.dat -export MWCIncludes := $(CURDIR)/lib/libc/include $(CURDIR)/lib/NitroSDK/include $(CURDIR)/lib/libnns/include +export MWCIncludes := $(CURDIR)/lib/MSL_C/include $(CURDIR)/lib/NitroSDK/include $(CURDIR)/lib/libnns/include export MWLibraries := $(CURDIR)/lib ######################### Targets ########################### @@ -204,16 +204,16 @@ ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS) $(LIB # TODO: Move out to lib/Makefile $(BUILD_DIR)/lib/%.o: MWCCVERSION = 1.2/sp2p3 -$(BUILD_DIR)/lib/%.o: MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/libc/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error +$(BUILD_DIR)/lib/%.o: MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/MSL_C/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error $(BUILD_DIR)/lib/libnns/%.o: MWCCVERSION = 1.2/sp3 -$(BUILD_DIR)/lib/libc/%.o: MWCCVERSION = 2.0/sp1 -$(BUILD_DIR)/lib/libc/%.o: MWCFLAGS += -ipa file +$(BUILD_DIR)/lib/MSL_C/%.o: MWCCVERSION = 2.0/sp1 +$(BUILD_DIR)/lib/MSL_C/%.o: MWCFLAGS += -ipa file ####################### Everything Else ###################### ifeq (,$(NODEP)) -$(BUILD_DIR)/%.o: dep = $(shell $(SCANINC) -I ../include -I ../include-mw -I lib/libc/include -I lib/libnns/include -I lib/NitroSDK/include $(filter $*.c,$(C_FILES)) $(filter $*.cpp,$(CXX_FILES)) $(filter $*.s,$(S_FILES)) $(filter $*.s,$(LIBS_FILES))) +$(BUILD_DIR)/%.o: dep = $(shell $(SCANINC) -I ../include -I ../include-mw -I lib/MSL_C/include -I lib/libnns/include -I lib/NitroSDK/include $(filter $*.c,$(C_FILES)) $(filter $*.cpp,$(CXX_FILES)) $(filter $*.s,$(S_FILES)) $(filter $*.s,$(LIBS_FILES))) else $(BUILD_DIR)/%.o: dep := endif diff --git a/arm9/lib/libc/Makefile b/arm9/lib/MSL_C/Makefile similarity index 87% rename from arm9/lib/libc/Makefile rename to arm9/lib/MSL_C/Makefile index 08fa004dd..67aa2af52 100644 --- a/arm9/lib/libc/Makefile +++ b/arm9/lib/MSL_C/Makefile @@ -54,7 +54,7 @@ OBJCOPY := $(CROSS)objcopy # ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o MWASFLAGS = -proc arm5te -ir ../../.. -MWCFLAGS = O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/libc/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error -ipa file +MWCFLAGS = O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/MSL_C/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error -ipa file MWLDFLAGS = -library -nodead -w off -proc v5te -interworking -pic ARFLAGS = rcS diff --git a/arm9/lib/libc/include/MSL.h b/arm9/lib/MSL_C/include/MSL.h similarity index 100% rename from arm9/lib/libc/include/MSL.h rename to arm9/lib/MSL_C/include/MSL.h diff --git a/arm9/lib/libc/include/MSL_Common_arith.h b/arm9/lib/MSL_C/include/MSL_Common_arith.h similarity index 100% rename from arm9/lib/libc/include/MSL_Common_arith.h rename to arm9/lib/MSL_C/include/MSL_Common_arith.h diff --git a/arm9/lib/libc/include/MSL_Common_rand.h b/arm9/lib/MSL_C/include/MSL_Common_rand.h similarity index 100% rename from arm9/lib/libc/include/MSL_Common_rand.h rename to arm9/lib/MSL_C/include/MSL_Common_rand.h diff --git a/arm9/lib/libc/include/ansi_params.h b/arm9/lib/MSL_C/include/ansi_params.h similarity index 100% rename from arm9/lib/libc/include/ansi_params.h rename to arm9/lib/MSL_C/include/ansi_params.h diff --git a/arm9/lib/libc/include/size_t.h b/arm9/lib/MSL_C/include/size_t.h similarity index 100% rename from arm9/lib/libc/include/size_t.h rename to arm9/lib/MSL_C/include/size_t.h diff --git a/arm9/lib/libc/include/string.h b/arm9/lib/MSL_C/include/string.h similarity index 100% rename from arm9/lib/libc/include/string.h rename to arm9/lib/MSL_C/include/string.h diff --git a/arm9/lib/libc/src/MSL_Common_arith.c b/arm9/lib/MSL_C/src/MSL_Common_arith.c similarity index 100% rename from arm9/lib/libc/src/MSL_Common_arith.c rename to arm9/lib/MSL_C/src/MSL_Common_arith.c diff --git a/arm9/lib/libc/src/MSL_Common_rand.c b/arm9/lib/MSL_C/src/MSL_Common_rand.c similarity index 100% rename from arm9/lib/libc/src/MSL_Common_rand.c rename to arm9/lib/MSL_C/src/MSL_Common_rand.c diff --git a/arm9/lib/Makefile b/arm9/lib/Makefile index 8ece4def8..496b3fee1 100644 --- a/arm9/lib/Makefile +++ b/arm9/lib/Makefile @@ -54,11 +54,11 @@ OBJCOPY := $(CROSS)objcopy # ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o MWASFLAGS = -proc arm5te -ir ../.. -MWCFLAGS = -O4,p -char signed -inline on,noauto -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i include -ir include-mw -ir arm9/lib/libc/include -ir arm9/lib/libnns/include -ir arm9/lib/NitroSDK/include -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error +MWCFLAGS = -O4,p -char signed -inline on,noauto -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i include -ir include-mw -ir arm9/lib/MSL_C/include -ir arm9/lib/libnns/include -ir arm9/lib/NitroSDK/include -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error MWLDFLAGS = -library -nodead -w off -proc v5te -interworking -pic -msgstyle gcc ARFLAGS = rcS -export MWCIncludes := libc/include libnns/include NitroSDK/include +export MWCIncludes := MSL_C/include libnns/include NitroSDK/include ################ Targets ################# @@ -69,12 +69,12 @@ all: libs $(LIBS) @: libs: - $(MAKE) -C libc + $(MAKE) -C MSL_C $(MAKE) -C libnns $(MAKE) -C NitroSDK clean: - $(MAKE) clean -C libc + $(MAKE) clean -C MSL_C $(MAKE) clean -C libnns $(MAKE) clean -C NitroSDK $(RM) $(LIBS) diff --git a/arm9/lib/NitroSDK/Makefile b/arm9/lib/NitroSDK/Makefile index 0d84879df..bf161bb82 100644 --- a/arm9/lib/NitroSDK/Makefile +++ b/arm9/lib/NitroSDK/Makefile @@ -54,7 +54,7 @@ OBJCOPY := $(CROSS)objcopy # ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o MWASFLAGS = -proc arm5te -ir ../../.. -MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/libc/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error +MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/MSL_C/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error MWLDFLAGS = -library -nodead -w off -proc v5te -interworking -pic -msgstyle gcc ARFLAGS = rcS diff --git a/arm9/lib/libnns/Makefile b/arm9/lib/libnns/Makefile index 72d82b57b..46dd65581 100644 --- a/arm9/lib/libnns/Makefile +++ b/arm9/lib/libnns/Makefile @@ -55,7 +55,7 @@ OBJCOPY := $(CROSS)objcopy # ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o MWASFLAGS = -proc arm5te -ir ../../.. -MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/libc/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error +MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/MSL_C/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error MWLDFLAGS = -library -nodead -w off -proc v5te -interworking -pic -msgstyle gcc ARFLAGS = rcS diff --git a/m2ctx.sh b/m2ctx.sh index 25fedb82f..99a4a99ec 100644 --- a/m2ctx.sh +++ b/m2ctx.sh @@ -4,7 +4,7 @@ OUT_FILE=ctx.c GCC=gcc FLAGS="-E -P -dD -undef" -INCLUDES="-Iinclude -Iinclude/constants -Iinclude/nitro -Iinclude-mw -Ifiles -Iarm9/lib/NitroSDK/include -Iarm9/lib/libc/include -Iarm9/lib/libnns/include -Iarm9/overlays/21/include -Iarm9/overlays/52/include -Iarm9/overlays/59/include -include global.h" +INCLUDES="-Iinclude -Iinclude/constants -Iinclude/nitro -Iinclude-mw -Ifiles -Iarm9/lib/NitroSDK/include -Iarm9/lib/MSL_C/include -Iarm9/lib/libnns/include -Iarm9/overlays/21/include -Iarm9/overlays/52/include -Iarm9/overlays/59/include -include global.h" DEFINES="-DDIAMOND" From be8ff53cebc760047ea927af006e81af581740ef Mon Sep 17 00:00:00 2001 From: red031000 Date: Fri, 30 Jun 2023 02:57:54 +0100 Subject: [PATCH 4/7] cleanup + scrcmd --- Makefile | 2 +- arm7/Makefile | 2 +- arm9/Makefile | 6 +- arm9/arm9.lsf | 4 +- arm9/asm/scrcmd_asm.s | 188 ------------------ arm9/asm/unk_02038C78.s | 10 +- arm9/asm/unk_02054C14.s | 4 +- arm9/global.inc | 12 +- arm9/lib/MSL_C/Makefile | 2 +- arm9/lib/MSL_C/include/MSL.h | 4 +- arm9/lib/MSL_C/include/MSL_Common_arith.h | 8 - arm9/lib/MSL_C/include/MSL_Common_rand.h | 9 - arm9/lib/MSL_C/include/ansi_params.h | 6 +- arm9/lib/MSL_C/include/arith.h | 6 + arm9/lib/MSL_C/include/rand.h | 7 + arm9/lib/MSL_C/include/size_t.h | 6 +- arm9/lib/MSL_C/include/string.h | 24 +-- arm9/lib/MSL_C/src/MSL_Common_arith.c | 8 - arm9/lib/MSL_C/src/arith.c | 6 + .../MSL_C/src/{MSL_Common_rand.c => rand.c} | 10 +- arm9/lib/Makefile | 2 +- arm9/lib/NitroSDK/Makefile | 2 +- arm9/lib/libnns/Makefile | 2 +- arm9/src/scrcmd.c | 56 +++++- include/scrcmd.h | 7 + tools/asmdiff/asmdiff.sh | 4 +- 26 files changed, 131 insertions(+), 266 deletions(-) delete mode 100644 arm9/lib/MSL_C/include/MSL_Common_arith.h delete mode 100644 arm9/lib/MSL_C/include/MSL_Common_rand.h create mode 100644 arm9/lib/MSL_C/include/arith.h create mode 100644 arm9/lib/MSL_C/include/rand.h delete mode 100644 arm9/lib/MSL_C/src/MSL_Common_arith.c create mode 100644 arm9/lib/MSL_C/src/arith.c rename arm9/lib/MSL_C/src/{MSL_Common_rand.c => rand.c} (57%) diff --git a/Makefile b/Makefile index 2e5de7bba..f608b4b9f 100644 --- a/Makefile +++ b/Makefile @@ -104,7 +104,7 @@ OBJCOPY := $(CROSS)objcopy # ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o MWASFLAGS = -proc arm5te -MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -ipa file -fp soft -lang c99 -Cpp_exceptions off -i include -ir include-mw -ir arm9/lib/MSL_C/include -ir arm9/lib/libnns/include -ir arm9/lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error +MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -ipa file -fp soft -lang c99 -Cpp_exceptions off -inline on,noauto -i include -ir include-mw -ir arm9/lib/MSL_C/include -ir arm9/lib/libnns/include -ir arm9/lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error MWLDFLAGS = -map -nodead -w off -proc v5te -interworking -map -symtab -m _start -msgstyle gcc ####################### Other Tools ######################### diff --git a/arm7/Makefile b/arm7/Makefile index c4fb714c7..1575ab40a 100644 --- a/arm7/Makefile +++ b/arm7/Makefile @@ -97,7 +97,7 @@ OBJCOPY := $(CROSS)objcopy # ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm7_thumb.s -o arm7.o MWASFLAGS = -proc arm4t -i .. -MWCFLAGS = -O4,s -proc arm7tdmi -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error +MWCFLAGS = -O4,s -proc arm7tdmi -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -inline on,noauto -i ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error MWLDFLAGS = -map -nodead -w off -proc v4t -interworking -map -symtab -m _start -msgstyle gcc ####################### Other Tools ######################### diff --git a/arm9/Makefile b/arm9/Makefile index 64f9a5d2b..b9d9f44da 100644 --- a/arm9/Makefile +++ b/arm9/Makefile @@ -117,8 +117,8 @@ ASM_PROCESSOR := $(ASM_PROCESSOR_DIR)/compile.sh # ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o MWASFLAGS = -proc arm5te -i ../include -i .. -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -ipa file -fp soft -lang c99 -Cpp_exceptions off $(foreach dir,$(INCLUDE_DIRS),-i $(dir)) $(foreach dir,$(INCLUDE_RECURSIVE_DIRS),-ir $(dir)) -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error -MWCXXFLAGS = -O4,p -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off $(foreach dir,$(INCLUDE_DIRS),-i $(dir)) $(foreach dir,$(INCLUDE_RECURSIVE_DIRS),-ir $(dir)) -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error +MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -ipa file -fp soft -lang c99 -Cpp_exceptions off -inline on,noauto $(foreach dir,$(INCLUDE_DIRS),-i $(dir)) $(foreach dir,$(INCLUDE_RECURSIVE_DIRS),-ir $(dir)) -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error +MWCXXFLAGS = -O4,p -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -inline on,noauto $(foreach dir,$(INCLUDE_DIRS),-i $(dir)) $(foreach dir,$(INCLUDE_RECURSIVE_DIRS),-ir $(dir)) -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error MWLDFLAGS = -w off -proc v5te -interworking -map closure,unused -symtab sort -m _start -msgstyle gcc LIBS := -Llib -lsyscall ARFLAGS = rcS @@ -204,7 +204,7 @@ ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS) $(LIB # TODO: Move out to lib/Makefile $(BUILD_DIR)/lib/%.o: MWCCVERSION = 1.2/sp2p3 -$(BUILD_DIR)/lib/%.o: MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/MSL_C/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error +$(BUILD_DIR)/lib/%.o: MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -inline on,noauto -i ../include -ir ../include-mw -ir lib/MSL_C/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error $(BUILD_DIR)/lib/libnns/%.o: MWCCVERSION = 1.2/sp3 $(BUILD_DIR)/lib/MSL_C/%.o: MWCCVERSION = 2.0/sp1 diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index 4945bb8d2..e43a7c995 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -551,7 +551,7 @@ Static arm9 Object MSL_ARM_critical_regions_NITRO.o Object MSL_ARM_math.o Object MSL_Common_ansi_files.o - Object MSL_Common_arith.o + Object arith.o Object MSL_Common_assert.o Object MSL_Common_buffer_io.o Object MSL_Common_ctype.o @@ -565,7 +565,7 @@ Static arm9 Object MSL_Common_mem_funcs.o Object MSL_Common_printf.o Object MSL_Common_qsort.o - Object MSL_Common_rand.o + Object rand.o Object MSL_Common_scanf.o Object MSL_Common_signal.o Object MSL_Common_string.o diff --git a/arm9/asm/scrcmd_asm.s b/arm9/asm/scrcmd_asm.s index 6815dd627..ffea61033 100644 --- a/arm9/asm/scrcmd_asm.s +++ b/arm9/asm/scrcmd_asm.s @@ -9,194 +9,6 @@ .text - thumb_func_start ScrCmd_Unk0265 -ScrCmd_Unk0265: ; 0x0203F00C - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - bl sub_0205F1C4 - mov r0, #0x0 - pop {r3, pc} - - thumb_func_start ScrCmd_Unk0266 -ScrCmd_Unk0266: ; 0x0203F020 - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - bl sub_0205F1D4 - mov r0, #0x0 - pop {r3, pc} - - thumb_func_start ScrCmd_Unk0267 -ScrCmd_Unk0267: ; 0x0203F034 - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - ldr r0, [r0, #0x10] - bl sub_020389CC - mov r0, #0x1 - pop {r4, pc} - - thumb_func_start ScrCmd_Unk0268 -ScrCmd_Unk0268: ; 0x0203F058 - push {r3-r5, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r4, #0x80 - add r5, r0, #0x0 - ldr r0, [r4, #0x0] - bl Script_GetHour - strh r0, [r5, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - - thumb_func_start ScrCmd_Unk0269 -ScrCmd_Unk0269: ; 0x0203F07C - push {r3-r7, lr} - sub sp, #0x10 - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r7, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - str r0, [sp, #0xc] - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - str r0, [sp, #0x8] - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r6, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r4, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - add r1, r7, #0x0 - ldr r0, [r0, #0x34] - bl GetMapObjectByID - add r7, r0, #0x0 - bne _0203F0FA - bl GF_AssertFail -_0203F0FA: - str r6, [sp, #0x0] - str r4, [sp, #0x4] - ldr r0, [r5, #0x74] - ldr r2, [sp, #0xc] - ldr r3, [sp, #0x8] - add r1, r7, #0x0 - bl sub_02054F50 - mov r0, #0x1 - add sp, #0x10 - pop {r3-r7, pc} - - thumb_func_start ScrCmd_Unk026A -ScrCmd_Unk026A: ; 0x0203F110 - push {r3-r7, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r5, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r7, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r6, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - add r1, r5, #0x0 - ldr r0, [r0, #0x34] - bl GetMapObjectByID - add r5, r0, #0x0 - bne _0203F164 - bl GF_AssertFail -_0203F164: - ldr r0, [r4, #0x74] - add r1, r5, #0x0 - add r2, r7, #0x0 - add r3, r6, #0x0 - bl sub_0205502C - mov r0, #0x1 - pop {r3-r7, pc} - - thumb_func_start ScrCmd_Unk026B -ScrCmd_Unk026B: ; 0x0203F174 - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r4, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl sub_02054E30 - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - thumb_func_start ScrCmd_Unk026C ScrCmd_Unk026C: ; 0x0203F19C push {r4-r7, lr} diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index e4bdd8b63..e965d3b0d 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -764,11 +764,11 @@ gScriptCmdTable: ; 0x020F355C .word ScrCmd_CheckBurmyForms .word ScrCmd_Unk0265 .word ScrCmd_Unk0266 - .word ScrCmd_Unk0267 - .word ScrCmd_Unk0268 - .word ScrCmd_Unk0269 - .word ScrCmd_Unk026A - .word ScrCmd_Unk026B + .word ScrCmd_SlotMachine + .word ScrCmd_GetHour + .word ScrCmd_ShakeEvent + .word ScrCmd_BlinkEvent + .word ScrCmd_CheckRegis .word ScrCmd_Unk026C .word ScrCmd_MessageUnown .word ScrCmd_Unk026E diff --git a/arm9/asm/unk_02054C14.s b/arm9/asm/unk_02054C14.s index 654641d35..881208862 100644 --- a/arm9/asm/unk_02054C14.s +++ b/arm9/asm/unk_02054C14.s @@ -319,8 +319,8 @@ _02054E28: .balign 4 _02054E2C: .word 0x00000000 - thumb_func_start sub_02054E30 -sub_02054E30: ; 0x02054E30 + thumb_func_start Save_PlayerHasAllRegisInParty +Save_PlayerHasAllRegisInParty: ; 0x02054E30 push {r3-r7, lr} sub sp, #0x10 mov r7, #0x0 diff --git a/arm9/global.inc b/arm9/global.inc index 16262c61f..96cccdc7b 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -3067,11 +3067,11 @@ .extern ScrCmd_CheckBurmyForms .extern ScrCmd_Unk0265 .extern ScrCmd_Unk0266 -.extern ScrCmd_Unk0267 -.extern ScrCmd_Unk0268 -.extern ScrCmd_Unk0269 -.extern ScrCmd_Unk026A -.extern ScrCmd_Unk026B +.extern ScrCmd_SlotMachine +.extern ScrCmd_GetHour +.extern ScrCmd_ShakeEvent +.extern ScrCmd_BlinkEvent +.extern ScrCmd_CheckRegis .extern ScrCmd_Unk026C .extern ScrCmd_Unk026E .extern ScrCmd_Unk026F @@ -3889,7 +3889,7 @@ .extern sub_02054CC8 .extern sub_02054D1C .extern sub_02054DEC -.extern sub_02054E30 +.extern Save_PlayerHasAllRegisInParty .extern sub_02054F50 .extern sub_0205502C .extern sub_02055068 diff --git a/arm9/lib/MSL_C/Makefile b/arm9/lib/MSL_C/Makefile index 67aa2af52..3043b1739 100644 --- a/arm9/lib/MSL_C/Makefile +++ b/arm9/lib/MSL_C/Makefile @@ -54,7 +54,7 @@ OBJCOPY := $(CROSS)objcopy # ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o MWASFLAGS = -proc arm5te -ir ../../.. -MWCFLAGS = O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/MSL_C/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error -ipa file +MWCFLAGS = O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -inline on,noauto -i ../include -ir ../include-mw -ir lib/MSL_C/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error -ipa file MWLDFLAGS = -library -nodead -w off -proc v5te -interworking -pic ARFLAGS = rcS diff --git a/arm9/lib/MSL_C/include/MSL.h b/arm9/lib/MSL_C/include/MSL.h index d991b4809..a21bbc756 100644 --- a/arm9/lib/MSL_C/include/MSL.h +++ b/arm9/lib/MSL_C/include/MSL.h @@ -4,7 +4,7 @@ //include all msl files here #include "string.h" -#include "MSL_Common_arith.h" -#include "MSL_Common_rand.h" +#include "arith.h" +#include "rand.h" #endif //MSL_H diff --git a/arm9/lib/MSL_C/include/MSL_Common_arith.h b/arm9/lib/MSL_C/include/MSL_Common_arith.h deleted file mode 100644 index 3ec6bdbce..000000000 --- a/arm9/lib/MSL_C/include/MSL_Common_arith.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef MSL_COMMON_ARITH_H -#define MSL_COMMON_ARITH_H - -#include "nitro/types.h" - -s32 abs(s32 val); - -#endif //MSL_COMMON_ARITH_H diff --git a/arm9/lib/MSL_C/include/MSL_Common_rand.h b/arm9/lib/MSL_C/include/MSL_Common_rand.h deleted file mode 100644 index 6b1f2c67c..000000000 --- a/arm9/lib/MSL_C/include/MSL_Common_rand.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef MSL_COMMON_RAND_H -#define MSL_COMMON_RAND_H - -#include "nitro/types.h" - -s32 rand(void); -void srand(u32 seed); - -#endif // MSL_COMMON_RAND_H diff --git a/arm9/lib/MSL_C/include/ansi_params.h b/arm9/lib/MSL_C/include/ansi_params.h index 3fb2e328f..e5fd614ab 100644 --- a/arm9/lib/MSL_C/include/ansi_params.h +++ b/arm9/lib/MSL_C/include/ansi_params.h @@ -1,5 +1,5 @@ -#ifndef _MSL_MSLEXTERN_H -#define _MSL_MSLEXTERN_H +#ifndef POKEDIAMOND_MSL_C_ANSI_PARAMS_H +#define POKEDIAMOND_MSL_C_ANSI_PARAMS_H #ifdef __cplusplus #define _MSL_BEGIN_NAMESPACE_STD namespace std { @@ -13,4 +13,4 @@ #define _MSL_END_NAMESPACE_STD #endif //__cplusplus -#endif //_MSL_MSLEXTERN_H +#endif //POKEDIAMOND_MSL_C_ANSI_PARAMS_H diff --git a/arm9/lib/MSL_C/include/arith.h b/arm9/lib/MSL_C/include/arith.h new file mode 100644 index 000000000..b998fb728 --- /dev/null +++ b/arm9/lib/MSL_C/include/arith.h @@ -0,0 +1,6 @@ +#ifndef POKEDIAMOND_MSL_C_ARITH_H +#define POKEDIAMOND_MSL_C_ARITH_H + +int abs(int val); + +#endif //POKEDIAMOND_MSL_C_ARITH_H diff --git a/arm9/lib/MSL_C/include/rand.h b/arm9/lib/MSL_C/include/rand.h new file mode 100644 index 000000000..f2c5fd896 --- /dev/null +++ b/arm9/lib/MSL_C/include/rand.h @@ -0,0 +1,7 @@ +#ifndef POKEDIAMOND_MSL_RAND_H +#define POKEDIAMOND_MSL_RAND_H + +int rand(void); +void srand(unsigned int seed); + +#endif // POKEDIAMOND_MSL_RAND_H diff --git a/arm9/lib/MSL_C/include/size_t.h b/arm9/lib/MSL_C/include/size_t.h index c4092419c..6de734d58 100644 --- a/arm9/lib/MSL_C/include/size_t.h +++ b/arm9/lib/MSL_C/include/size_t.h @@ -1,5 +1,5 @@ -#ifndef _MSL_SIZE_T_H -#define _MSL_SIZE_T_H +#ifndef POKEDIAMOND_MSL_C_SIZE_T_H +#define POKEDIAMOND_MSL_C_SIZE_T_H #include "ansi_params.h" @@ -11,4 +11,4 @@ typedef __typeof__(sizeof(0)) size_t; _MSL_END_EXTERN_C _MSL_END_NAMESPACE_STD -#endif //_MSL_SIZE_T_H +#endif //POKEDIAMOND_MSL_C_SIZE_T_H diff --git a/arm9/lib/MSL_C/include/string.h b/arm9/lib/MSL_C/include/string.h index 885bfaabf..80e1b4fac 100644 --- a/arm9/lib/MSL_C/include/string.h +++ b/arm9/lib/MSL_C/include/string.h @@ -1,5 +1,5 @@ -#ifndef GUARD_MSL_STRING_H -#define GUARD_MSL_STRING_H +#ifndef POKEDIAMOND_MSL_C_STRING_H +#define POKEDIAMOND_MSL_C_STRING_H #include "ansi_params.h" #include "size_t.h" @@ -12,17 +12,17 @@ void *memmove(void *dest, const void *src, size_t size); void *memcpy(void *dest, const void *src, size_t size); void *memchr(const void *arr, int value, size_t size); int memcmp(const void *a, const void *b, size_t size); -signed char *strcpy(signed char *dest, const signed char *src); -unsigned strlen(const signed char *str); -signed char *strncpy(signed char *dest, const signed char *src, size_t n); -int strcmp(const signed char *a, const signed char *b); -signed char *strcat(signed char *dest, const signed char *src); -signed char *strncat(signed char *dest, const signed char *src, size_t n); -unsigned strspn(const signed char *a, const signed char *b); -signed char *strtok(signed char *str, const signed char *sep); -signed char *strstr(const signed char *haystack, const signed char *needle); +char *strcpy(char *dest, const char *src); +unsigned strlen(const char *str); +char *strncpy(char *dest, const char *src, size_t n); +int strcmp(const char *a, const char *b); +char *strcat(char *dest, const char *src); +char *strncat(char *dest, const char *src, size_t n); +unsigned strspn(const char *a, const char *b); +char *strtok(char *str, const char *sep); +char *strstr(const char *haystack, const char *needle); _MSL_END_EXTERN_C _MSL_END_NAMESPACE_STD -#endif //GUARD_MSL_STRING_H +#endif //POKEDIAMOND_MSL_C_STRING_H diff --git a/arm9/lib/MSL_C/src/MSL_Common_arith.c b/arm9/lib/MSL_C/src/MSL_Common_arith.c deleted file mode 100644 index 1938126cb..000000000 --- a/arm9/lib/MSL_C/src/MSL_Common_arith.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "MSL_Common_arith.h" -#include "nitro/types.h" -#include "code32.h" - -s32 abs(s32 val) -{ - return val < 0 ? -val : val; -} diff --git a/arm9/lib/MSL_C/src/arith.c b/arm9/lib/MSL_C/src/arith.c new file mode 100644 index 000000000..33d315005 --- /dev/null +++ b/arm9/lib/MSL_C/src/arith.c @@ -0,0 +1,6 @@ +#include "arith.h" +#include "code32.h" + +int abs(int val) { + return val < 0 ? -val : val; +} diff --git a/arm9/lib/MSL_C/src/MSL_Common_rand.c b/arm9/lib/MSL_C/src/rand.c similarity index 57% rename from arm9/lib/MSL_C/src/MSL_Common_rand.c rename to arm9/lib/MSL_C/src/rand.c index 76b5b65bd..6224059c2 100644 --- a/arm9/lib/MSL_C/src/MSL_Common_rand.c +++ b/arm9/lib/MSL_C/src/rand.c @@ -1,15 +1,13 @@ -#include "MSL_Common_rand.h" +#include "rand.h" #include "code32.h" -static u32 random_next = 1; +static unsigned long int random_next = 1; -s32 rand(void) -{ +int rand(void) { random_next = random_next * 1103515245 + 12345; return ((random_next >> 16) & 0x7fff); } -void srand(u32 seed) -{ +void srand(unsigned int seed) { random_next = seed; } diff --git a/arm9/lib/Makefile b/arm9/lib/Makefile index 496b3fee1..88c7be0a6 100644 --- a/arm9/lib/Makefile +++ b/arm9/lib/Makefile @@ -54,7 +54,7 @@ OBJCOPY := $(CROSS)objcopy # ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o MWASFLAGS = -proc arm5te -ir ../.. -MWCFLAGS = -O4,p -char signed -inline on,noauto -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i include -ir include-mw -ir arm9/lib/MSL_C/include -ir arm9/lib/libnns/include -ir arm9/lib/NitroSDK/include -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error +MWCFLAGS = -O4,p -inline on,noauto -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i include -ir include-mw -ir arm9/lib/MSL_C/include -ir arm9/lib/libnns/include -ir arm9/lib/NitroSDK/include -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error MWLDFLAGS = -library -nodead -w off -proc v5te -interworking -pic -msgstyle gcc ARFLAGS = rcS diff --git a/arm9/lib/NitroSDK/Makefile b/arm9/lib/NitroSDK/Makefile index bf161bb82..1c30d1f02 100644 --- a/arm9/lib/NitroSDK/Makefile +++ b/arm9/lib/NitroSDK/Makefile @@ -54,7 +54,7 @@ OBJCOPY := $(CROSS)objcopy # ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o MWASFLAGS = -proc arm5te -ir ../../.. -MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/MSL_C/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error +MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -inline on,noauto -i ../include -ir ../include-mw -ir lib/MSL_C/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error MWLDFLAGS = -library -nodead -w off -proc v5te -interworking -pic -msgstyle gcc ARFLAGS = rcS diff --git a/arm9/lib/libnns/Makefile b/arm9/lib/libnns/Makefile index 46dd65581..35e3b8e03 100644 --- a/arm9/lib/libnns/Makefile +++ b/arm9/lib/libnns/Makefile @@ -55,7 +55,7 @@ OBJCOPY := $(CROSS)objcopy # ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o MWASFLAGS = -proc arm5te -ir ../../.. -MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/MSL_C/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error +MWCFLAGS = -O4,p -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -inline on,noauto -i ../include -ir ../include-mw -ir lib/MSL_C/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error MWLDFLAGS = -library -nodead -w off -proc v5te -interworking -pic -msgstyle gcc ARFLAGS = rcS diff --git a/arm9/src/scrcmd.c b/arm9/src/scrcmd.c index 5dc2fff6d..46fcbc7c7 100644 --- a/arm9/src/scrcmd.c +++ b/arm9/src/scrcmd.c @@ -349,6 +349,10 @@ extern void sub_020649D4(FieldSystem *fieldSystem); extern BOOL sub_020649B0(FieldSystem *fieldSystem); extern void ov06_0224E764(FieldSystem *fieldSystem); extern void ov06_0224E7C4(FieldSystem *fieldSystem); +extern void sub_020389CC(TaskManager *taskManager, u16 param1); +extern void sub_02054F50(TaskManager *taskManager, LocalMapObject *mapObject, u16 count, u16 frames, u16 x, u16 y); +extern void sub_0205502C(TaskManager *taskManager, LocalMapObject *mapObject, u16 count, u16 frames); +extern u16 Save_PlayerHasAllRegisInParty(SaveData *saveData); u8 UNK_021C5A0C[4]; @@ -4272,4 +4276,54 @@ asm BOOL ScrCmd_CheckBurmyForms(ScriptContext *ctx) { add sp, #0x30 pop {r3-r7, pc} } -#endif \ No newline at end of file +#endif + +BOOL ScrCmd_Unk0265(ScriptContext *ctx) { //0265 + sub_0205F1C4(Save_VarsFlags_Get(ctx->fieldSystem->saveData)); + return FALSE; +} + +BOOL ScrCmd_Unk0266(ScriptContext *ctx) { //0266 + sub_0205F1D4(Save_VarsFlags_Get(ctx->fieldSystem->saveData)); + return FALSE; +} + +BOOL ScrCmd_SlotMachine(ScriptContext *ctx) { //0267 + u16 unk0 = ScriptGetVar(ctx); + sub_020389CC(ctx->fieldSystem->taskManager, unk0); + return TRUE; +} + +BOOL ScrCmd_GetHour(ScriptContext *ctx) { //0268 + u16 *var = ScriptGetVarPointer(ctx); + *var = Script_GetHour(ctx->fieldSystem); + return FALSE; +} + +BOOL ScrCmd_ShakeEvent(ScriptContext *ctx) { //0269 + u16 eventId = ScriptGetVar(ctx); + u16 count = ScriptGetVar(ctx); + u16 frames = ScriptGetVar(ctx); + u16 x = ScriptGetVar(ctx); + u16 y = ScriptGetVar(ctx); + LocalMapObject *mapObject = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, eventId); + GF_ASSERT(mapObject != NULL); + sub_02054F50(ctx->taskManager, mapObject, count, frames, x, y); + return TRUE; +} + +BOOL ScrCmd_BlinkEvent(ScriptContext *ctx) { //026A + u16 eventId = ScriptGetVar(ctx); + u16 count = ScriptGetVar(ctx); + u16 frames = ScriptGetVar(ctx); + LocalMapObject *mapObject = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, eventId); + GF_ASSERT(mapObject != NULL); + sub_0205502C(ctx->taskManager, mapObject, count, frames); + return TRUE; +} + +BOOL ScrCmd_CheckRegis(ScriptContext *ctx) { //026B + u16 *var = ScriptGetVarPointer(ctx); + *var = Save_PlayerHasAllRegisInParty(ctx->fieldSystem->saveData); + return FALSE; +} diff --git a/include/scrcmd.h b/include/scrcmd.h index 4495340d1..1e84bdb67 100644 --- a/include/scrcmd.h +++ b/include/scrcmd.h @@ -401,6 +401,13 @@ BOOL ScrCmd_AddSpecialGameStat(ScriptContext *ctx); BOOL ScrCmd_CheckPokemonInParty(ScriptContext *ctx); BOOL ScrCmd_SetDeoxysForm(ScriptContext *ctx); BOOL ScrCmd_CheckBurmyForms(ScriptContext *ctx); +BOOL ScrCmd_Unk0265(ScriptContext *ctx); +BOOL ScrCmd_Unk0266(ScriptContext *ctx); +BOOL ScrCmd_SlotMachine(ScriptContext *ctx); +BOOL ScrCmd_GetHour(ScriptContext *ctx); +BOOL ScrCmd_ShakeEvent(ScriptContext *ctx); +BOOL ScrCmd_BlinkEvent(ScriptContext *ctx); +BOOL ScrCmd_CheckRegis(ScriptContext *ctx); // scrcmd_mart.c BOOL ScrCmd_NormalMart(ScriptContext *ctx); diff --git a/tools/asmdiff/asmdiff.sh b/tools/asmdiff/asmdiff.sh index fe0c976aa..624fbe44e 100644 --- a/tools/asmdiff/asmdiff.sh +++ b/tools/asmdiff/asmdiff.sh @@ -127,13 +127,13 @@ case "$mode" in $MYDIR/ntruncompbw $basefile $vma $((vma+compsize)) || { rm -f $basefile; exit 1; } } } - buildfile=$builddir/MODULE_${overlay}.sbin + buildfile=$builddir/OVERLAY_${overlay}.sbin ;; static) case $proc in armv4t) romtab=48 - compname=ichneumon_sub + compname=arm7 ;; armv5te) romtab=32 From 87af9d41acce95f917cfbf68069d13a4da2488c4 Mon Sep 17 00:00:00 2001 From: red031000 Date: Fri, 30 Jun 2023 04:26:02 +0100 Subject: [PATCH 5/7] some more scrcmd --- arm9/asm/scrcmd_asm.s | 216 ---------------------------------------- arm9/asm/unk_02038C78.s | 6 +- arm9/asm/unk_0204CB20.s | 2 +- arm9/asm/unk_0205F314.s | 4 +- arm9/global.inc | 8 +- arm9/src/game_init.c | 2 +- arm9/src/main.c | 2 +- arm9/src/scrcmd.c | 87 +++++++++++++++- include/main.h | 2 +- include/scrcmd.h | 7 ++ 10 files changed, 106 insertions(+), 230 deletions(-) diff --git a/arm9/asm/scrcmd_asm.s b/arm9/asm/scrcmd_asm.s index ffea61033..02773ec25 100644 --- a/arm9/asm/scrcmd_asm.s +++ b/arm9/asm/scrcmd_asm.s @@ -9,222 +9,6 @@ .text - thumb_func_start ScrCmd_Unk026C -ScrCmd_Unk026C: ; 0x0203F19C - push {r4-r7, lr} - sub sp, #0x24 - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r4, #0x80 - str r0, [sp, #0x0] - ldr r0, [r4, #0x0] - ldr r0, [r0, #0xc] - bl Save_FashionData_Get - bl Save_FashionData_GetFashionCase - mov r6, #0x0 - add r7, r0, #0x0 - add r4, r6, #0x0 - add r5, sp, #0x4 -_0203F1CA: - add r1, r4, #0x0 - add r0, r7, #0x0 - add r1, #0x22 - mov r2, #0x1 - bl sub_020270D8 - cmp r0, #0x1 - bne _0203F1E0 - mov r0, #0x1 - strh r0, [r5, #0x0] - add r6, r6, #0x1 -_0203F1E0: - add r4, r4, #0x1 - add r5, r5, #0x2 - cmp r4, #0x10 - blt _0203F1CA - cmp r6, #0x0 - bne _0203F1F8 - ldr r0, [sp, #0x0] - ldr r1, _0203F230 ; =0x0000FFFF - add sp, #0x24 - strh r1, [r0, #0x0] - mov r0, #0x0 - pop {r4-r7, pc} -_0203F1F8: - bl LCRandom - add r1, r6, #0x0 - bl _s32_div_f - mov r4, #0x0 - add r2, sp, #0x4 -_0203F206: - ldrh r0, [r2, #0x0] - cmp r0, #0x1 - bne _0203F212 - cmp r1, #0x0 - beq _0203F21A - sub r1, r1, #0x1 -_0203F212: - add r4, r4, #0x1 - add r2, r2, #0x2 - cmp r4, #0x10 - blt _0203F206 -_0203F21A: - cmp r4, #0x10 - blt _0203F222 - bl GF_AssertFail -_0203F222: - ldr r0, [sp, #0x0] - add r4, #0x22 - strh r4, [r0, #0x0] - mov r0, #0x0 - add sp, #0x24 - pop {r4-r7, pc} - nop -_0203F230: .word 0x0000FFFF - - thumb_func_start ScrCmd_Unk026E -ScrCmd_Unk026E: ; 0x0203F234 - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - ldr r1, _0203F250 ; =gSystem + 0x60 - ldrb r1, [r1, #0x6] - strh r1, [r0, #0x0] - mov r0, #0x1 - pop {r4, pc} - .balign 4 -_0203F250: .word gSystem + 0x60 - - thumb_func_start ScrCmd_Unk026F -ScrCmd_Unk026F: ; 0x0203F254 - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - mov r1, #0x0 - bl sub_0205F698 - mov r0, #0x0 - pop {r3, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk0270 -ScrCmd_Unk0270: ; 0x0203F26C - push {r4-r6, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r5, #0x80 - ldr r0, [r5, #0x0] - ldrb r4, [r1, #0x0] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - cmp r4, #0x0 - beq _0203F2A0 - add r1, r6, #0x0 - bl sub_0205F4E4 - b _0203F2A6 -_0203F2A0: - add r1, r6, #0x0 - bl sub_0205F50C -_0203F2A6: - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk0273 -ScrCmd_Unk0273: ; 0x0203F2AC - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FieldSysGetAttrAddr - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferContestBackgroundName - mov r0, #0x1 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk0275 -ScrCmd_Unk0275: ; 0x0203F2E4 - push {r3-r5, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - add r5, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - add r4, r0, #0x0 - add r0, r5, #0x0 - bl sub_0205F6C8 - cmp r0, #0xa - blo _0203F314 - mov r0, #0x1 - b _0203F316 -_0203F314: - mov r0, #0x0 -_0203F316: - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - - thumb_func_start ScrCmd_Unk0277 -ScrCmd_Unk0277: ; 0x0203F31C - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r4, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - bl sub_0205F648 - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - thumb_func_start ScrCmd_Unk0279 ScrCmd_Unk0279: ; 0x0203F348 push {r4-r6, lr} diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index e965d3b0d..b659655a1 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -771,12 +771,12 @@ gScriptCmdTable: ; 0x020F355C .word ScrCmd_CheckRegis .word ScrCmd_Unk026C .word ScrCmd_MessageUnown - .word ScrCmd_Unk026E - .word ScrCmd_Unk026F + .word ScrCmd_CheckGBACartridge + .word ScrCmd_ResetSpiritombTalkCounter .word ScrCmd_Unk0270 .word ScrCmd_WriteWhiteRockInscription .word ScrCmd_GetWhiteRockInscription - .word ScrCmd_Unk0273 + .word ScrCmd_BufferContestBackgroundName .word ScrCmd_HasEnoughCoinsImmediate .word ScrCmd_Unk0275 .word ScrCmd_CanGiveCoins diff --git a/arm9/asm/unk_0204CB20.s b/arm9/asm/unk_0204CB20.s index 5668a3cce..ce963a2b8 100644 --- a/arm9/asm/unk_0204CB20.s +++ b/arm9/asm/unk_0204CB20.s @@ -4119,7 +4119,7 @@ _0204E9B8: lsl r1, r1, #0x10 add r0, r6, #0x0 lsr r1, r1, #0x10 - bl sub_0205F698 + bl Save_VarsFlags_SetSpiritombTalkCounter add r0, r6, #0x0 bl sub_0205F6A8 add r1, r0, #0x0 diff --git a/arm9/asm/unk_0205F314.s b/arm9/asm/unk_0205F314.s index 91abf4d4a..c5308a25d 100644 --- a/arm9/asm/unk_0205F314.s +++ b/arm9/asm/unk_0205F314.s @@ -508,8 +508,8 @@ Save_VarsFlags_GetSpiritombTalkCounter: ; 0x0205F688 _0205F690: .word sub_0205F344 _0205F694: .word 0x0000403E - thumb_func_start sub_0205F698 -sub_0205F698: ; 0x0205F698 + thumb_func_start Save_VarsFlags_SetSpiritombTalkCounter +Save_VarsFlags_SetSpiritombTalkCounter: ; 0x0205F698 ldr r3, _0205F6A0 ; =sub_0205F314 add r2, r1, #0x0 ldr r1, _0205F6A4 ; =0x0000403E diff --git a/arm9/global.inc b/arm9/global.inc index 96cccdc7b..835479655 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -3073,10 +3073,10 @@ .extern ScrCmd_BlinkEvent .extern ScrCmd_CheckRegis .extern ScrCmd_Unk026C -.extern ScrCmd_Unk026E -.extern ScrCmd_Unk026F +.extern ScrCmd_CheckGBACartridge +.extern ScrCmd_ResetSpiritombTalkCounter .extern ScrCmd_Unk0270 -.extern ScrCmd_Unk0273 +.extern ScrCmd_BufferContestBackgroundName .extern ScrCmd_Unk0275 .extern ScrCmd_Unk0277 .extern ScrCmd_Unk0279 @@ -4608,7 +4608,7 @@ .extern sub_0205F648 .extern sub_0205F668 .extern Save_VarsFlags_GetSpiritombTalkCounter -.extern sub_0205F698 +.extern Save_VarsFlags_SetSpiritombTalkCounter .extern sub_0205F6A8 .extern sub_0205F6B8 .extern sub_0205F6C8 diff --git a/arm9/src/game_init.c b/arm9/src/game_init.c index 62b4e7502..bbc188055 100644 --- a/arm9/src/game_init.c +++ b/arm9/src/game_init.c @@ -355,7 +355,7 @@ void InitKeypadAndTouchpad(void) void sub_02016438(u8 a0) { - gSystem.unk66 = a0; + gSystem.gbaCartId = a0; } void sub_02016444(u8 a0) diff --git a/arm9/src/main.c b/arm9/src/main.c index 1142d6800..0d10f1f28 100644 --- a/arm9/src/main.c +++ b/arm9/src/main.c @@ -290,7 +290,7 @@ void HandleDSLidAction(void) while (1) { PMWakeUpTrigger trigger = PM_TRIGGER_COVER_OPEN | PM_TRIGGER_CARD; - if (gSystem.unk66 && !r1) + if (gSystem.gbaCartId && !r1) trigger |= PM_TRIGGER_CARTRIDGE; PM_GoSleepMode(trigger, PM_PAD_LOGIC_OR, 0); if (CARD_IsPulledOut()) diff --git a/arm9/src/scrcmd.c b/arm9/src/scrcmd.c index 46fcbc7c7..82cee63c8 100644 --- a/arm9/src/scrcmd.c +++ b/arm9/src/scrcmd.c @@ -300,7 +300,7 @@ extern void *sub_0202914C(u8 param0, u16 param1, u32 param2); extern void sub_0205F3F8(SaveVarsFlags *state, u32 param1); extern FashionCase *Save_FashionData_GetFashionCase(SaveFashionData *saveFashionData); extern void sub_020271A4(FashionCase *fashionCase, u16 param1, u16 param2); -extern u16 sub_020270D8(FashionCase *fashionCase, u16 param1, u16 param2); +extern BOOL sub_020270D8(FashionCase *fashionCase, u32 param1, u16 param2); extern u16 sub_02027114(FashionCase *fashionCase, u16 param1); extern void sub_02027264(FashionCase *fashionCase, u16 param1); extern u16 sub_02027100(FashionCase *fashionCase, u16 param1); @@ -353,6 +353,11 @@ extern void sub_020389CC(TaskManager *taskManager, u16 param1); extern void sub_02054F50(TaskManager *taskManager, LocalMapObject *mapObject, u16 count, u16 frames, u16 x, u16 y); extern void sub_0205502C(TaskManager *taskManager, LocalMapObject *mapObject, u16 count, u16 frames); extern u16 Save_PlayerHasAllRegisInParty(SaveData *saveData); +extern void Save_VarsFlags_SetSpiritombTalkCounter(SaveVarsFlags *varsFlags, u32 value); +extern void sub_0205F4E4(SaveVarsFlags *varsFlags, u16 alternativeId); +extern void sub_0205F50C(SaveVarsFlags *varsFlags, u16 alternativeId); +extern u32 sub_0205F6C8(SaveVarsFlags *varsFlags); +extern u16 sub_0205F648(SaveVarsFlags *varsFlags); u8 UNK_021C5A0C[4]; @@ -4327,3 +4332,83 @@ BOOL ScrCmd_CheckRegis(ScriptContext *ctx) { //026B *var = Save_PlayerHasAllRegisInParty(ctx->fieldSystem->saveData); return FALSE; } + +BOOL ScrCmd_Unk026C(ScriptContext *ctx) { //026C + u16 *var = ScriptGetVarPointer(ctx); + FashionCase *fashionCase = Save_FashionData_GetFashionCase(Save_FashionData_Get(ctx->fieldSystem->saveData)); + s32 i; + u32 k; + s32 n = 0; + u16 unk0[16]; + for (i = 0; i < 16; i++) { + if (sub_020270D8(fashionCase, i + 34, 1) == TRUE) { + unk0[i] = 1; + n++; + } + } + if (n == 0) { + *var = -1; + return FALSE; + } + k = LCRandom() % n; + for (i = 0; i < 16; i++) { + if (unk0[i] == 1) { + if (k == 0) { + break; + } + k--; + } + } + GF_ASSERT(i < 16); + *var = i + 34; + return FALSE; +} + +BOOL ScrCmd_CheckGBACartridge(ScriptContext *ctx) { //026E + u16 *var = ScriptGetVarPointer(ctx); + *var = gSystem.gbaCartId; + return TRUE; +} + +BOOL ScrCmd_ResetSpiritombTalkCounter(ScriptContext *ctx) { //026F + Save_VarsFlags_SetSpiritombTalkCounter(Save_VarsFlags_Get(ctx->fieldSystem->saveData), 0); + return FALSE; +} + +BOOL ScrCmd_Unk0270(ScriptContext *ctx) { //0270 - todo: SetMatrixAlternativeMap + u16 alternativeId = ScriptGetVar(ctx); + u8 status = ScriptReadByte(ctx); + SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); + + if (status) { + sub_0205F4E4(varsFlags, alternativeId); + } else { + sub_0205F50C(varsFlags, alternativeId); + } + return FALSE; +} + +BOOL ScrCmd_BufferContestBackgroundName(ScriptContext *ctx) { //0273 + MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); + u8 bufferId = ScriptReadByte(ctx); + u16 backgroundId = ScriptGetVar(ctx); + BufferContestBackgroundName(*messageFormat, bufferId, backgroundId); + return TRUE; +} + +BOOL ScrCmd_Unk0275(ScriptContext *ctx) { //0275 + SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); + u16 *var = ScriptGetVarPointer(ctx); + if (sub_0205F6C8(varsFlags) >= 10) { + *var = 1; + } else { + *var = 0; + } + return FALSE; +} + +BOOL ScrCmd_Unk0277(ScriptContext *ctx) { //0277 + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_0205F648(Save_VarsFlags_Get(ctx->fieldSystem->saveData)); + return FALSE; +} diff --git a/include/main.h b/include/main.h index 67fc3998d..10b017a15 100644 --- a/include/main.h +++ b/include/main.h @@ -62,7 +62,7 @@ struct Main u16 touchHeld; u8 touchpadReadAuto; u8 screensFlipped; - u8 unk66; + u8 gbaCartId; u8 unk67; u8 softResetDisabled; u8 padding_69[3]; // nice diff --git a/include/scrcmd.h b/include/scrcmd.h index 1e84bdb67..d6d122aaf 100644 --- a/include/scrcmd.h +++ b/include/scrcmd.h @@ -408,6 +408,13 @@ BOOL ScrCmd_GetHour(ScriptContext *ctx); BOOL ScrCmd_ShakeEvent(ScriptContext *ctx); BOOL ScrCmd_BlinkEvent(ScriptContext *ctx); BOOL ScrCmd_CheckRegis(ScriptContext *ctx); +BOOL ScrCmd_Unk026C(ScriptContext *ctx); +BOOL ScrCmd_CheckGBACartridge(ScriptContext *ctx); +BOOL ScrCmd_ResetSpiritombTalkCounter(ScriptContext *ctx); +BOOL ScrCmd_Unk0270(ScriptContext *ctx); +BOOL ScrCmd_BufferContestBackgroundName(ScriptContext *ctx); +BOOL ScrCmd_Unk0275(ScriptContext *ctx); +BOOL ScrCmd_Unk0277(ScriptContext *ctx); // scrcmd_mart.c BOOL ScrCmd_NormalMart(ScriptContext *ctx); From 995e424d88b9d1716b85d5e4a3e301d553c492cd Mon Sep 17 00:00:00 2001 From: red031000 Date: Fri, 30 Jun 2023 17:56:24 +0100 Subject: [PATCH 6/7] a lot of scrcmd --- arm9/arm9.lsf | 2 +- arm9/asm/scrcmd_asm.s | 455 +----------------- arm9/asm/unk_02027E30.s | 10 +- arm9/asm/unk_02038C78.s | 8 +- arm9/asm/unk_02046030.s | 4 +- arm9/asm/unk_02087D00.s | 4 +- arm9/global.inc | 20 +- arm9/overlays/52/include/overlay_52.h | 2 +- arm9/overlays/52/src/overlay_52.c | 2 +- arm9/overlays/73/asm/overlay_73.s | 4 +- arm9/overlays/75/asm/overlay_75.s | 2 +- arm9/src/save_arrays.c | 2 +- .../{sav_system_info.c => save_system_info.c} | 30 +- arm9/src/scrcmd.c | 170 ++++++- arm9/src/unk_020139D8.c | 8 +- arm9/src/unk_0208890C.c | 4 +- .../{sav_system_info.h => save_system_info.h} | 33 +- include/scrcmd.h | 13 + include/script.h | 8 + include/unk_020139D8.h | 6 +- include/unk_0204B0A0.h | 2 +- include/unk_0208890C.h | 2 +- 22 files changed, 262 insertions(+), 529 deletions(-) rename arm9/src/{sav_system_info.c => save_system_info.c} (71%) rename include/{sav_system_info.h => save_system_info.h} (55%) diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index e43a7c995..de9910dd6 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -89,7 +89,7 @@ Static arm9 Object unk_02022504.o Object save.o Object save_arrays.o - Object sav_system_info.o + Object save_system_info.o Object player_data.o Object unk_02023AC4.o Object daycare.o diff --git a/arm9/asm/scrcmd_asm.s b/arm9/asm/scrcmd_asm.s index 02773ec25..bb1462cae 100644 --- a/arm9/asm/scrcmd_asm.s +++ b/arm9/asm/scrcmd_asm.s @@ -9,459 +9,6 @@ .text - thumb_func_start ScrCmd_Unk0279 -ScrCmd_Unk0279: ; 0x0203F348 - push {r4-r6, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r5, #0x80 - add r6, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl Save_FashionData_Get - bl Save_FashionData_GetFashionCase - add r1, r4, #0x0 - add r2, r6, #0x0 - bl sub_02027210 - mov r0, #0x0 - pop {r4-r6, pc} - - thumb_func_start ScrCmd_Unk027A -ScrCmd_Unk027A: ; 0x0203F38C - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - bl sub_02046030 - mov r0, #0x1 - pop {r3, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk027B -ScrCmd_Unk027B: ; 0x0203F39C - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl sub_0205F668 - mov r0, #0x0 - pop {r3, pc} - - thumb_func_start ScrCmd_Unk027D -ScrCmd_Unk027D: ; 0x0203F3AC - push {r3-r7, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r7, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FieldSysGetAttrAddr - add r5, #0x80 - add r6, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl Save_EasyChat_Get - bl sub_02013B74 - cmp r0, #0x20 - bne _0203F3FE - ldr r0, _0203F414 ; =0x0000FFFF - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r7, pc} -_0203F3FE: - strh r0, [r4, #0x0] - bl sub_02013BE4 - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r7, #0x0 - bl BufferECWord - mov r0, #0x0 - pop {r3-r7, pc} - nop -_0203F414: .word 0x0000FFFF - - thumb_func_start ScrCmd_Unk027F -ScrCmd_Unk027F: ; 0x0203F418 - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r4, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl Save_EasyChat_Get - bl sub_02013BC8 - cmp r0, #0x1 - bne _0203F444 - mov r0, #0x1 - b _0203F446 -_0203F444: - mov r0, #0x0 -_0203F446: - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - - thumb_func_start ScrCmd_Unk027E -ScrCmd_Unk027E: ; 0x0203F44C - push {r3-r5, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - add r5, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - add r4, r0, #0x0 - add r0, r5, #0x0 - bl sub_0205F710 - cmp r0, #0x5 - blo _0203F47C - mov r0, #0x1 - b _0203F47E -_0203F47C: - mov r0, #0x0 -_0203F47E: - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - - thumb_func_start ScrCmd_Unk0282 -ScrCmd_Unk0282: ; 0x0203F484 - push {r3-r7, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - ldr r5, [r5, #0x0] - add r4, r0, #0x0 - ldr r0, [r5, #0xc] - bl Save_SysInfo_Get - add r7, r0, #0x0 - bl Save_SysInfo_GetBirthMonth - add r6, r0, #0x0 - add r0, r5, #0x0 - bl Script_GetMonth - cmp r6, r0 - bne _0203F4CE - add r0, r7, #0x0 - bl Save_SysInfo_GetBirthDay - add r6, r0, #0x0 - add r0, r5, #0x0 - bl Script_GetDay - cmp r6, r0 - bne _0203F4CE - mov r0, #0x1 - strh r0, [r4, #0x0] - b _0203F4D2 -_0203F4CE: - mov r0, #0x0 - strh r0, [r4, #0x0] -_0203F4D2: - mov r0, #0x0 - pop {r3-r7, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk0284 -ScrCmd_Unk0284: ; 0x0203F4D8 - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Save_Pokedex_Get - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - add r0, r4, #0x0 - bl Pokedex_CountSeenUnown - strh r0, [r5, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk0285 -ScrCmd_Unk0285: ; 0x0203F508 - push {r3-r7, lr} - add r6, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r6, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r7, r0, #0x0 - add r0, r6, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r6, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r1, r6, #0x0 - add r1, #0x80 - ldr r1, [r1, #0x0] - ldr r2, [r1, #0x1c] - ldr r1, [r2, #0x8] - lsl r1, r1, #0x10 - lsr r5, r1, #0x10 - ldr r1, [r2, #0xc] - lsl r1, r1, #0x10 - lsr r4, r1, #0x10 - cmp r7, #0x3 - blo _0203F54C - ldr r7, _0203F5C8 ; =0x0000010E - b _0203F582 -_0203F54C: - cmp r0, #0x1e - blo _0203F556 - mov r7, #0x43 - lsl r7, r7, #0x2 - b _0203F582 -_0203F556: - bl LCRandom - mov r1, #0x64 - bl _s32_div_f - cmp r1, #0x19 - bge _0203F568 - ldr r7, _0203F5CC ; =0x0000010D - b _0203F582 -_0203F568: - bl LCRandom - mov r1, #0x6 - bl _s32_div_f - lsl r0, r1, #0x10 - lsr r1, r0, #0x10 - mov r0, #0x6 - mul r0, r7 - add r0, r1, r0 - lsl r1, r0, #0x1 - ldr r0, _0203F5D0 ; =UNK_020F3538 - ldrh r7, [r0, r1] -_0203F582: - cmp r5, #0xb - bne _0203F59A - cmp r4, #0x1 - bne _0203F58E - mov r4, #0x0 - b _0203F5A4 -_0203F58E: - cmp r4, #0x14 - bne _0203F596 - mov r4, #0x2 - b _0203F5A4 -_0203F596: - mov r4, #0x5 - b _0203F5A4 -_0203F59A: - cmp r5, #0x14 - bne _0203F5A2 - mov r4, #0x1 - b _0203F5A4 -_0203F5A2: - mov r4, #0x3 -_0203F5A4: - mov r5, #0x0 -_0203F5A6: - cmp r5, r4 - beq _0203F5B8 - add r0, r6, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - add r1, r5, #0x0 - add r2, r7, #0x0 - bl sub_02034C24 -_0203F5B8: - add r0, r5, #0x1 - lsl r0, r0, #0x18 - lsr r5, r0, #0x18 - cmp r5, #0x4 - blo _0203F5A6 - mov r0, #0x0 - pop {r3-r7, pc} - nop -_0203F5C8: .word 0x0000010E -_0203F5CC: .word 0x0000010D -_0203F5D0: .word UNK_020F3538 - - thumb_func_start ScrCmd_Unk0286 -ScrCmd_Unk0286: ; 0x0203F5D4 - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - add r0, r4, #0x0 - bl sub_0205F720 - strh r0, [r5, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk0287 -ScrCmd_Unk0287: ; 0x0203F604 - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - add r0, r4, #0x0 - bl sub_0205F740 - strh r0, [r5, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk0288 -ScrCmd_Unk0288: ; 0x0203F634 - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - add r0, r4, #0x0 - bl sub_0205F760 - strh r0, [r5, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk0289 -ScrCmd_Unk0289: ; 0x0203F664 - push {r3-r7, lr} - sub sp, #0x8 - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r4, r0, #0x0 - add r0, r5, #0x0 - mov r2, #0x0 - add r3, sp, #0x0 - add r0, #0x8 -_0203F684: - ldr r6, [r0, #0x0] - ldr r1, [r5, #0x8] - add r6, r6, #0x1 - str r6, [r0, #0x0] - ldrb r1, [r1, #0x0] - add r2, r2, #0x1 - strb r1, [r3, #0x0] - add r3, r3, #0x1 - cmp r2, #0x5 - blt _0203F684 - ldr r1, [r0, #0x0] - ldr r2, [r5, #0x8] - add r1, r1, #0x1 - str r1, [r0, #0x0] - ldrb r6, [r2, #0x0] - mov r0, #0x4 - bl sub_02027E5C - add r1, sp, #0x0 - add r2, r6, #0x0 - mov r3, #0x0 - add r7, r0, #0x0 - bl sub_02027F04 - add r5, #0x80 - add r6, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl sub_02028048 - add r1, r7, #0x0 - bl sub_02028094 - add r5, r0, #0x0 - add r0, r7, #0x0 - bl FreeToHeap - ldr r0, _0203F6E0 ; =0x0000FFFF - cmp r5, r0 - bne _0203F6D8 - strh r0, [r4, #0x0] - b _0203F6DA -_0203F6D8: - strh r6, [r4, #0x0] -_0203F6DA: - mov r0, #0x0 - add sp, #0x8 - pop {r3-r7, pc} - .balign 4 -_0203F6E0: .word 0x0000FFFF - thumb_func_start ScrCmd_Unk028A ScrCmd_Unk028A: ; 0x0203F6E4 push {r3-r5, lr} @@ -476,7 +23,7 @@ ScrCmd_Unk028A: ; 0x0203F6E4 add r4, r0, #0x0 ldr r0, [r5, #0x0] ldr r0, [r0, #0xc] - bl sub_02028048 + bl Save_PoffinData_Get bl sub_02028074 ldr r1, _0203F71C ; =0x0000FFFF cmp r0, r1 diff --git a/arm9/asm/unk_02027E30.s b/arm9/asm/unk_02027E30.s index 14e7cf59f..d55749da9 100644 --- a/arm9/asm/unk_02027E30.s +++ b/arm9/asm/unk_02027E30.s @@ -35,8 +35,8 @@ sub_02027E44: ; 0x02027E44 bx lr .balign 4 - thumb_func_start sub_02027E5C -sub_02027E5C: ; 0x02027E5C + thumb_func_start Poffin_New +Poffin_New: ; 0x02027E5C push {r4, lr} mov r1, #0x8 bl AllocFromHeapAtEnd @@ -331,8 +331,8 @@ _02028044: pop {r4, pc} .balign 4 - thumb_func_start sub_02028048 -sub_02028048: ; 0x02028048 + thumb_func_start Save_PoffinData_Get +Save_PoffinData_Get: ; 0x02028048 ldr r3, _02028050 ; =SaveArray_Get mov r1, #0x10 bx r3 @@ -530,7 +530,7 @@ sub_02028190: ; 0x02028190 add r5, r0, #0x0 add r0, r2, #0x0 add r4, r1, #0x0 - bl sub_02027E5C + bl Poffin_New add r6, r0, #0x0 cmp r4, #0x64 blo _020281AA diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index b659655a1..f0dc1a277 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -783,17 +783,17 @@ gScriptCmdTable: ; 0x020F355C .word ScrCmd_Unk0277 .word ScrCmd_GetPartyMonLevel .word ScrCmd_Unk0279 - .word ScrCmd_Unk027A + .word ScrCmd_UseSunyshoreBinoculars .word ScrCmd_Unk027B .word ScrCmd_Unk027C - .word ScrCmd_Unk027D + .word ScrCmd_BufferRandomTrendySaying .word ScrCmd_Unk027E .word ScrCmd_Unk027F .word ScrCmd_Unk0280 .word ScrCmd_GetPartyMonContestCondition - .word ScrCmd_Unk0282 + .word ScrCmd_CheckBirthday .word ScrCmd_SetVolume - .word ScrCmd_Unk0284 + .word ScrCmd_CountSeenUnown .word ScrCmd_Unk0285 .word ScrCmd_Unk0286 .word ScrCmd_Unk0287 diff --git a/arm9/asm/unk_02046030.s b/arm9/asm/unk_02046030.s index 7188d0324..98fa2329b 100644 --- a/arm9/asm/unk_02046030.s +++ b/arm9/asm/unk_02046030.s @@ -5,8 +5,8 @@ .text - thumb_func_start sub_02046030 -sub_02046030: ; 0x02046030 + thumb_func_start CallTask_UseSunyshoreBinoculars +CallTask_UseSunyshoreBinoculars: ; 0x02046030 push {r4, lr} add r4, r0, #0x0 mov r0, #0xb diff --git a/arm9/asm/unk_02087D00.s b/arm9/asm/unk_02087D00.s index 0d4cecaf7..b3ef8d230 100644 --- a/arm9/asm/unk_02087D00.s +++ b/arm9/asm/unk_02087D00.s @@ -57,7 +57,7 @@ sub_02087D00: ; 0x02087D00 add r7, r0, #0x0 bl MI_CpuFill8 add r0, r4, #0x0 - bl sub_02028048 + bl Save_PoffinData_Get str r0, [r7, #0x8] add r0, r4, #0x0 bl Save_PlayerData_GetProfileAddr @@ -72,7 +72,7 @@ sub_02087D00: ; 0x02087D00 bl Save_PlayerData_GetOptionsAddr str r0, [r7, #0x18] add r0, r5, #0x0 - bl sub_02027E5C + bl Poffin_New add r4, r0, #0x0 mov r0, #0x1 mov r1, #0x20 diff --git a/arm9/global.inc b/arm9/global.inc index 835479655..fdeb06bed 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -912,9 +912,9 @@ .extern sub_02013B2C .extern Save_EasyChat_Get .extern sub_02013B68 -.extern sub_02013B74 -.extern sub_02013BC8 -.extern sub_02013BE4 +.extern Save_EasyChat_RandomTrendySayingSet +.extern Save_EasyChat_TrendySayingsUnlockedAllCheck +.extern TrendyWordIdxToECWord .extern sub_02013C0C .extern sub_02013C18 .extern sub_02013C28 @@ -1840,12 +1840,12 @@ .extern Save_FashionData_Get .extern sub_02027E30 .extern sub_02027E34 -.extern sub_02027E5C +.extern Poffin_New .extern sub_02027E94 .extern sub_02027F04 .extern sub_02027FBC .extern sub_02027FDC -.extern sub_02028048 +.extern Save_PoffinData_Get .extern sub_02028054 .extern sub_0202805C .extern sub_02028074 @@ -3080,13 +3080,13 @@ .extern ScrCmd_Unk0275 .extern ScrCmd_Unk0277 .extern ScrCmd_Unk0279 -.extern ScrCmd_Unk027A +.extern ScrCmd_UseSunyshoreBinoculars .extern ScrCmd_Unk027B -.extern ScrCmd_Unk027D +.extern ScrCmd_BufferRandomTrendySaying .extern ScrCmd_Unk027F .extern ScrCmd_Unk027E -.extern ScrCmd_Unk0282 -.extern ScrCmd_Unk0284 +.extern ScrCmd_CheckBirthday +.extern ScrCmd_CountSeenUnown .extern ScrCmd_Unk0285 .extern ScrCmd_Unk0286 .extern ScrCmd_Unk0287 @@ -3419,7 +3419,7 @@ .extern ScrCmd_Unk0240 .extern ScrCmd_Unk0241 .extern ScrCmd_Unk0242 -.extern sub_02046030 +.extern CallTask_UseSunyshoreBinoculars .extern Save_VarsFlags_sizeof .extern Save_VarsFlags_Init .extern Save_VarsFlags_Get diff --git a/arm9/overlays/52/include/overlay_52.h b/arm9/overlays/52/include/overlay_52.h index 0dfd9e376..8f761856a 100644 --- a/arm9/overlays/52/include/overlay_52.h +++ b/arm9/overlays/52/include/overlay_52.h @@ -9,7 +9,7 @@ #include "overlay_manager.h" #include "player_data.h" #include "poke_overlay.h" -#include "sav_system_info.h" +#include "save_system_info.h" #include "save.h" #include "unk_02024E64.h" #include "unk_020286F8.h" diff --git a/arm9/overlays/52/src/overlay_52.c b/arm9/overlays/52/src/overlay_52.c index 1f170e6f2..399c2f9cf 100644 --- a/arm9/overlays/52/src/overlay_52.c +++ b/arm9/overlays/52/src/overlay_52.c @@ -233,7 +233,7 @@ BOOL ov52_021D7594(struct OverlayManager *manager, u32 *status) #pragma unused(status) struct SaveData *save = (struct SaveData *)OverlayManager_GetField18(manager)[2]; // weird - struct SavSysInfo *save_info = Save_SysInfo_Get(save); + struct SaveSysInfo *save_info = Save_SysInfo_Get(save); ov52_021D7688(0x4d, save); Options_SetButtonModeOnMain(save, 0); diff --git a/arm9/overlays/73/asm/overlay_73.s b/arm9/overlays/73/asm/overlay_73.s index 236944224..9b56d9653 100644 --- a/arm9/overlays/73/asm/overlay_73.s +++ b/arm9/overlays/73/asm/overlay_73.s @@ -847,7 +847,7 @@ _021D7BC6: cmp r0, #0 bne _021D7C12 ldr r0, [r4] - bl sub_02027E5C + bl Poffin_New add r6, r0, #0 ldr r0, [r4] ldr r3, _021D7C68 ; =0x0000142C @@ -1983,7 +1983,7 @@ ov73_021D852C: ; 0x021D852C push {r3, r4, r5, lr} add r4, r0, #0 ldr r0, [r4] - bl sub_02027E5C + bl Poffin_New ldr r1, _021D8560 ; =0x0000152C str r0, [r4, r1] ldr r0, _021D8564 ; =0x00001424 diff --git a/arm9/overlays/75/asm/overlay_75.s b/arm9/overlays/75/asm/overlay_75.s index 2ccef7066..89ecc391d 100644 --- a/arm9/overlays/75/asm/overlay_75.s +++ b/arm9/overlays/75/asm/overlay_75.s @@ -9788,7 +9788,7 @@ ov75_021EB8E8: ; 0x021EB8E8 add r0, #0xc4 ldr r0, [r0] ldr r0, [r0] - bl sub_02028048 + bl Save_PoffinData_Get bl sub_020281B8 add r2, r0, #0 mov r0, #1 diff --git a/arm9/src/save_arrays.c b/arm9/src/save_arrays.c index d05ea9793..b6c1a32f4 100644 --- a/arm9/src/save_arrays.c +++ b/arm9/src/save_arrays.c @@ -5,7 +5,7 @@ #include "party.h" #include "event_data.h" #include "pokemon_storage_system.h" -#include "sav_system_info.h" +#include "save_system_info.h" #include "poketch.h" #include "hall_of_fame.h" #include "unk_020286F8.h" diff --git a/arm9/src/sav_system_info.c b/arm9/src/save_system_info.c similarity index 71% rename from arm9/src/sav_system_info.c rename to arm9/src/save_system_info.c index 6ef22bc1e..209683073 100644 --- a/arm9/src/sav_system_info.c +++ b/arm9/src/save_system_info.c @@ -4,24 +4,24 @@ #include "OS_ownerInfo.h" #include "RTC_api.h" #include "RTC_convert.h" -#include "sav_system_info.h" +#include "save_system_info.h" extern void GF_RTC_CopyDateTime(RTCDate *, RTCTime *); u32 Save_SysInfo_sizeof(void) { - return sizeof(struct SavSysInfo); + return sizeof(struct SaveSysInfo); } -void Save_SysInfo_Init(struct SavSysInfo * unk) +void Save_SysInfo_Init(struct SaveSysInfo * unk) { - MI_CpuClearFast(unk, sizeof(struct SavSysInfo)); + MI_CpuClearFast(unk, sizeof(struct SaveSysInfo)); Save_SysInfo_RTC_Init(&unk->rtcInfo); } -struct SavSysInfo * Save_SysInfo_Get(struct SaveData * save) +struct SaveSysInfo * Save_SysInfo_Get(struct SaveData * save) { - return (struct SavSysInfo *)SaveArray_Get(save, 0); + return (struct SaveSysInfo *)SaveArray_Get(save, 0); } struct UnkSaveStruct_0202376C_sub * Save_SysInfo_RTC_Get(struct SaveData * save) @@ -29,7 +29,7 @@ struct UnkSaveStruct_0202376C_sub * Save_SysInfo_RTC_Get(struct SaveData * save) return &Save_SysInfo_Get(save)->rtcInfo; } -void Save_SysInfo_InitFromSystem(struct SavSysInfo * unk) +void Save_SysInfo_InitFromSystem(struct SaveSysInfo * unk) { OSOwnerInfo info; unk->rtcOffset = OS_GetOwnerRtcOffset(); @@ -39,7 +39,7 @@ void Save_SysInfo_InitFromSystem(struct SavSysInfo * unk) unk->birthDay = info.birthday.day; } -BOOL Save_SysInfo_MacAddressIsMine(struct SavSysInfo * unk) +BOOL Save_SysInfo_MacAddressIsMine(struct SaveSysInfo * unk) { u8 macAddr[6]; OS_GetMacAddress(macAddr); @@ -51,37 +51,37 @@ BOOL Save_SysInfo_MacAddressIsMine(struct SavSysInfo * unk) return TRUE; } -BOOL Save_SysInfo_RTCOffsetIsMine(struct SavSysInfo * unk) +BOOL Save_SysInfo_RTCOffsetIsMine(struct SaveSysInfo * unk) { return OS_GetOwnerRtcOffset() == unk->rtcOffset; } -u8 Save_SysInfo_GetBirthMonth(struct SavSysInfo * unk) +u8 Save_SysInfo_GetBirthMonth(struct SaveSysInfo * unk) { return unk->birthMonth; } -u8 Save_SysInfo_GetBirthDay(struct SavSysInfo * unk) +u8 Save_SysInfo_GetBirthDay(struct SaveSysInfo * unk) { return unk->birthDay; } -u8 sub_02023820(struct SavSysInfo * unk) +u8 sub_02023820(struct SaveSysInfo * unk) { return unk->field_48; } -void sub_02023828(struct SavSysInfo * unk, u8 val) +void sub_02023828(struct SaveSysInfo * unk, u8 val) { unk->field_48 = val; } -u32 sub_02023830(struct SavSysInfo * unk) +u32 sub_02023830(struct SaveSysInfo * unk) { return unk->field_4C; } -void sub_02023834(struct SavSysInfo * unk, u32 val) +void sub_02023834(struct SaveSysInfo * unk, u32 val) { if (unk->field_4C == 0) unk->field_4C = val; diff --git a/arm9/src/scrcmd.c b/arm9/src/scrcmd.c index 82cee63c8..bb9ed05e8 100644 --- a/arm9/src/scrcmd.c +++ b/arm9/src/scrcmd.c @@ -23,6 +23,7 @@ #include "render_window.h" #include "safari_zone.h" #include "save.h" +#include "save_system_info.h" #include "seal.h" #include "task.h" #include "text.h" @@ -147,8 +148,8 @@ extern void ShowGeonetScreen(FieldSystem *fieldSystem); extern void ShowSealCapsuleEditor(TaskManager *taskManager, SaveData *save); extern void sub_0205F7A0(FieldSystem *fieldSystem, TownMapAppData *townMap, u32 param2); //TownMap_Init? extern void sub_02037E90(FieldSystem *fieldSystem, TownMapAppData *townMap); //ShowTownMap? -extern u32 sub_02028048(SaveData *save); -extern u32 sub_020281B8(u32 param0); +extern SavePoffinData *Save_PoffinData_Get(SaveData *save); +extern u32 sub_020281B8(SavePoffinData *savePoffinData); extern void sub_02037FE4(FieldSystem *fieldSystem, ScrCmdUnkStruct01D9 *param1); extern void LaunchStoragePCInterface(FieldSystem *fieldSystem, PCBoxAppData *pcBoxAppData); extern void sub_020383F8(FieldSystem *fieldSystem); @@ -358,11 +359,23 @@ extern void sub_0205F4E4(SaveVarsFlags *varsFlags, u16 alternativeId); extern void sub_0205F50C(SaveVarsFlags *varsFlags, u16 alternativeId); extern u32 sub_0205F6C8(SaveVarsFlags *varsFlags); extern u16 sub_0205F648(SaveVarsFlags *varsFlags); +extern void sub_02027210(FashionCase *fashionCase, u16 param1, u16 param2); +extern void CallTask_UseSunyshoreBinoculars(FieldSystem *fieldSystem); +extern void sub_0205F668(SaveData *saveData); +extern u16 sub_0205F710(SaveVarsFlags *varsFlags); +extern void sub_02034C24(FieldSystem *fieldSystem, u8 param1, u16 param2); +extern u16 sub_0205F720(SaveVarsFlags *varsFlags); +extern u16 sub_0205F740(SaveVarsFlags *varsFlags); +extern u16 sub_0205F760(SaveVarsFlags *varsFlags); +extern Poffin *Poffin_New(HeapID heapId); +extern u32 sub_02027F04(Poffin *poffin, u8 *bytes, u8 param2, u32 param3); +extern u16 sub_02028094(SavePoffinData *savePoffinData, Poffin *poffin); u8 UNK_021C5A0C[4]; extern u8 *UNK_020F34E0; extern const u32 UNK_020F34FC[PARTY_SIZE]; +extern const u16 UNK_020F3538[18]; static BOOL RunPauseTimer(ScriptContext *ctx); static u32 Compare(u16 a, u16 b); @@ -2331,7 +2344,7 @@ BOOL ScrCmd_Unk01D8(ScriptContext *ctx) { //01D8 *unk0 = 1; return FALSE; } - else if (sub_020281B8(sub_02028048(ctx->fieldSystem->saveData)) >= 0x64) { + else if (sub_020281B8(Save_PoffinData_Get(ctx->fieldSystem->saveData)) >= 0x64) { *unk0 = 2; return FALSE; } @@ -4412,3 +4425,154 @@ BOOL ScrCmd_Unk0277(ScriptContext *ctx) { //0277 *var = sub_0205F648(Save_VarsFlags_Get(ctx->fieldSystem->saveData)); return FALSE; } + +BOOL ScrCmd_Unk0279(ScriptContext *ctx) { //0279 + u16 unk0 = ScriptGetVar(ctx); + u16 unk1 = ScriptGetVar(ctx); + sub_02027210(Save_FashionData_GetFashionCase(Save_FashionData_Get(ctx->fieldSystem->saveData)), unk0, unk1); + return FALSE; +} + +BOOL ScrCmd_UseSunyshoreBinoculars(ScriptContext *ctx) { //027A + CallTask_UseSunyshoreBinoculars(ctx->fieldSystem); + return TRUE; +} + +BOOL ScrCmd_Unk027B(ScriptContext *ctx) { //027B + sub_0205F668(ctx->fieldSystem->saveData); + return FALSE; +} + +BOOL ScrCmd_BufferRandomTrendySaying(ScriptContext *ctx) { //027D + u16 *var = ScriptGetVarPointer(ctx); + u16 fieldId = ScriptGetVar(ctx); + MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); + u32 trendy = Save_EasyChat_RandomTrendySayingSet(Save_EasyChat_Get(ctx->fieldSystem->saveData)); + if (trendy == 32) { + *var = -1; + return FALSE; + } + *var = trendy; + BufferECWord(*messageFormat, fieldId, TrendyWordIdxToECWord(trendy)); + return FALSE; +} + +BOOL ScrCmd_Unk027F(ScriptContext *ctx) { //027F + u16 *var = ScriptGetVarPointer(ctx); + *var = Save_EasyChat_TrendySayingsUnlockedAllCheck(Save_EasyChat_Get(ctx->fieldSystem->saveData)) == TRUE; + return FALSE; +} + +BOOL ScrCmd_Unk027E(ScriptContext *ctx) { //027E + SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_0205F710(varsFlags) >= 5; + return FALSE; +} + +BOOL ScrCmd_CheckBirthday(ScriptContext *ctx) { //0282 + u16 *var = ScriptGetVarPointer(ctx); + FieldSystem *fieldSystem = ctx->fieldSystem; + SaveSysInfo *sysInfo = Save_SysInfo_Get(ctx->fieldSystem->saveData); + if (Save_SysInfo_GetBirthMonth(sysInfo) == Script_GetMonth(fieldSystem) && Save_SysInfo_GetBirthDay(sysInfo) == Script_GetDay(fieldSystem)) { + *var = TRUE; + } else { + *var = FALSE; + } + return FALSE; +} + +BOOL ScrCmd_CountSeenUnown(ScriptContext *ctx) { //0284 + Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); + u16 *var = ScriptGetVarPointer(ctx); + *var = Pokedex_CountSeenUnown(pokedex); + return FALSE; +} + +BOOL ScrCmd_Unk0285(ScriptContext *ctx) { //0285 + u16 unk0 = ScriptGetVar(ctx); + u16 unk1 = ScriptGetVar(ctx); + u16 x = ctx->fieldSystem->location->x; + u16 y = ctx->fieldSystem->location->y; + + u16 unk2 = 0; + if (unk0 >= 3) { + unk2 = 270; + } else if (unk1 >= 30) { + unk2 = 268; + } else if (LCRandom() % 100 < 25) { + unk2 = 269; + } else { + unk2 = LCRandom() % 6; + unk2 = UNK_020F3538[unk2 + (unk0 * 6)]; + } + + u8 unk3; + if (x == 11) { + if (y == 1) { + unk3 = 0; + } else if (y == 20) { + unk3 = 2; + } else { + unk3 = 5; + } + } else { + if (x == 20) { + unk3 = 1; + } else { + unk3 = 3; + } + } + + for (u8 i = 0; i < 4; i++) { + if (i == unk3) { + continue; + } + + sub_02034C24(ctx->fieldSystem, i, unk2); + } + return FALSE; +} + +BOOL ScrCmd_Unk0286(ScriptContext *ctx) { //0286 + SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_0205F720(varsFlags); + return FALSE; +} + +BOOL ScrCmd_Unk0287(ScriptContext *ctx) { //0287 + SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_0205F740(varsFlags); + return FALSE; +} + +BOOL ScrCmd_Unk0288(ScriptContext *ctx) { //0288 + SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_0205F760(varsFlags); + return FALSE; +} + +BOOL ScrCmd_Unk0289(ScriptContext *ctx) { //0289 + u16 *var = ScriptGetVarPointer(ctx); + u8 bytes[5]; + + for (s32 i = 0; i < 5; i++) { + bytes[i] = ScriptReadByte(ctx); + } + u8 unk0 = ScriptReadByte(ctx); + Poffin *poffin = Poffin_New(HEAP_ID_4); + u32 unk1 = sub_02027F04(poffin, bytes, unk0, 0); + SavePoffinData *poffinSave = Save_PoffinData_Get(ctx->fieldSystem->saveData); + u16 unk2 = sub_02028094(poffinSave, poffin); + FreeToHeap(poffin); + + if (unk2 == 0xFFFF) { + *var = -1; + } else { + *var = unk1; + } + return FALSE; +} diff --git a/arm9/src/unk_020139D8.c b/arm9/src/unk_020139D8.c index 1f0bb628d..b6fe201cd 100644 --- a/arm9/src/unk_020139D8.c +++ b/arm9/src/unk_020139D8.c @@ -187,7 +187,7 @@ BOOL sub_02013B68(struct SaveEasyChat * unk, u32 a1) return (BOOL)((unk->unk_4 >> a1) & 1); } -s32 sub_02013B74(struct SaveEasyChat * unk) +u32 Save_EasyChat_RandomTrendySayingSet(struct SaveEasyChat * unk) { u32 i; u32 count; @@ -207,7 +207,7 @@ s32 sub_02013B74(struct SaveEasyChat * unk) if (which_bit == 0) { unk->unk_4 |= (1 << i); - return (s32)i; + return i; } which_bit--; } @@ -216,7 +216,7 @@ s32 sub_02013B74(struct SaveEasyChat * unk) return 32; } -BOOL sub_02013BC8(struct SaveEasyChat * unk) +BOOL Save_EasyChat_TrendySayingsUnlockedAllCheck(struct SaveEasyChat * unk) { u32 i; for (i = 0; i < 32; i++) @@ -227,7 +227,7 @@ BOOL sub_02013BC8(struct SaveEasyChat * unk) return TRUE; } -u16 sub_02013BE4(u16 a0) +u16 TrendyWordIdxToECWord(u32 a0) { s32 i; u16 skip = 0; diff --git a/arm9/src/unk_0208890C.c b/arm9/src/unk_0208890C.c index f16bf0601..577d6d31d 100644 --- a/arm9/src/unk_0208890C.c +++ b/arm9/src/unk_0208890C.c @@ -8,7 +8,7 @@ #include "poke_overlay.h" extern struct SaveData* FieldSystem_GetSaveDataPtr(struct FieldSystem *); -extern u32 sub_02028048(struct SaveData* save); +extern SavePoffinData *Save_PoffinData_Get(struct SaveData* save); extern void sub_020373D4(struct FieldSystem *, struct OverlayManagerTemplate *, void*); extern BOOL sub_020889B0(struct OverlayManager *, u32*); extern BOOL sub_02088A00(struct OverlayManager *, u32*); @@ -27,7 +27,7 @@ struct PoffinCaseAppData* sub_0208890C(u32 a0, struct SaveData* save, HeapID hea MI_CpuFill8(ret, 0, sizeof(struct PoffinCaseAppData)); ret->save = save; - ret->unk8 = sub_02028048(save); + ret->savePoffinData = Save_PoffinData_Get(save); ret->player = Save_PlayerData_GetProfileAddr(save); ret->bag = Save_Bag_Get(save); ret->options = Save_PlayerData_GetOptionsAddr(save); diff --git a/include/sav_system_info.h b/include/save_system_info.h similarity index 55% rename from include/sav_system_info.h rename to include/save_system_info.h index cac1f291d..25db223d0 100644 --- a/include/sav_system_info.h +++ b/include/save_system_info.h @@ -1,7 +1,8 @@ -#ifndef POKEDIAMOND_SAV_SYSTEM_INFO_H -#define POKEDIAMOND_SAV_SYSTEM_INFO_H +#ifndef POKEDIAMOND_SAVE_SYSTEM_INFO_H +#define POKEDIAMOND_SAVE_SYSTEM_INFO_H #include "RTC_api.h" +#include "nitro/types.h" struct SaveData; @@ -16,7 +17,7 @@ struct UnkSaveStruct_0202376C_sub /* 0x34 */ u32 field_34; }; -struct SavSysInfo +typedef struct SaveSysInfo { /* 0x00 */ s64 rtcOffset; /* 0x08 */ u8 macAddr[6]; @@ -27,24 +28,24 @@ struct SavSysInfo u8 filler_49[3]; /* 0x4C */ u32 field_4C; u8 padding_50[12]; -}; +} SaveSysInfo; u32 Save_SysInfo_sizeof(void); -void Save_SysInfo_Init(struct SavSysInfo * unk); -struct SavSysInfo * Save_SysInfo_Get(struct SaveData * save); +void Save_SysInfo_Init(struct SaveSysInfo * unk); +struct SaveSysInfo * Save_SysInfo_Get(struct SaveData * save); struct UnkSaveStruct_0202376C_sub * Save_SysInfo_RTC_Get(struct SaveData * save); -void Save_SysInfo_InitFromSystem(struct SavSysInfo * unk); -BOOL Save_SysInfo_MacAddressIsMine(struct SavSysInfo * unk); -BOOL Save_SysInfo_RTCOffsetIsMine(struct SavSysInfo * unk); -u8 Save_SysInfo_GetBirthMonth(struct SavSysInfo * unk); -u8 Save_SysInfo_GetBirthDay(struct SavSysInfo * unk); -u8 sub_02023820(struct SavSysInfo * unk); -void sub_02023828(struct SavSysInfo * unk, u8 val); -u32 sub_02023830(struct SavSysInfo * unk); -void sub_02023834(struct SavSysInfo * unk, u32 val); +void Save_SysInfo_InitFromSystem(struct SaveSysInfo * unk); +BOOL Save_SysInfo_MacAddressIsMine(struct SaveSysInfo * unk); +BOOL Save_SysInfo_RTCOffsetIsMine(struct SaveSysInfo * unk); +u8 Save_SysInfo_GetBirthMonth(struct SaveSysInfo * unk); +u8 Save_SysInfo_GetBirthDay(struct SaveSysInfo * unk); +u8 sub_02023820(struct SaveSysInfo * unk); +void sub_02023828(struct SaveSysInfo * unk, u8 val); +u32 sub_02023830(struct SaveSysInfo * unk); +void sub_02023834(struct SaveSysInfo * unk, u32 val); void Save_SysInfo_RTC_Init(struct UnkSaveStruct_0202376C_sub * sub); BOOL sub_02023874(struct UnkSaveStruct_0202376C_sub * sub); void sub_02023884(struct UnkSaveStruct_0202376C_sub * sub, u32 a1); void sub_020238A4(struct UnkSaveStruct_0202376C_sub * sub); -#endif //POKEDIAMOND_SAV_SYSTEM_INFO_H +#endif //POKEDIAMOND_SAVE_SYSTEM_INFO_H diff --git a/include/scrcmd.h b/include/scrcmd.h index d6d122aaf..d1d42c4a4 100644 --- a/include/scrcmd.h +++ b/include/scrcmd.h @@ -415,6 +415,19 @@ BOOL ScrCmd_Unk0270(ScriptContext *ctx); BOOL ScrCmd_BufferContestBackgroundName(ScriptContext *ctx); BOOL ScrCmd_Unk0275(ScriptContext *ctx); BOOL ScrCmd_Unk0277(ScriptContext *ctx); +BOOL ScrCmd_Unk0279(ScriptContext *ctx); +BOOL ScrCmd_UseSunyshoreBinoculars(ScriptContext *ctx); +BOOL ScrCmd_Unk027B(ScriptContext *ctx); +BOOL ScrCmd_BufferRandomTrendySaying(ScriptContext *ctx); +BOOL ScrCmd_Unk027F(ScriptContext *ctx); +BOOL ScrCmd_Unk027E(ScriptContext *ctx); +BOOL ScrCmd_CheckBirthday(ScriptContext *ctx); +BOOL ScrCmd_CountSeenUnown(ScriptContext *ctx); +BOOL ScrCmd_Unk0285(ScriptContext *ctx); +BOOL ScrCmd_Unk0286(ScriptContext *ctx); +BOOL ScrCmd_Unk0287(ScriptContext *ctx); +BOOL ScrCmd_Unk0288(ScriptContext *ctx); +BOOL ScrCmd_Unk0289(ScriptContext *ctx); // scrcmd_mart.c BOOL ScrCmd_NormalMart(ScriptContext *ctx); diff --git a/include/script.h b/include/script.h index 866d8a1f8..e2302a4ef 100644 --- a/include/script.h +++ b/include/script.h @@ -111,6 +111,14 @@ typedef struct NPCTradeAppData { } NPCTradeAppData; //todo: fill out and move to own file +typedef struct Poffin { + +} Poffin; //todo: fill out and move to own file + +typedef struct SavePoffinData { + +} SavePoffinData; //todo: fill out and move to own file + typedef struct FieldSystem //todo move to field_system.c { u32 *unk00; diff --git a/include/unk_020139D8.h b/include/unk_020139D8.h index fde174a0c..38714b370 100644 --- a/include/unk_020139D8.h +++ b/include/unk_020139D8.h @@ -23,9 +23,9 @@ u32 sub_02013B28(void); void sub_02013B2C(struct SaveEasyChat * unk); struct SaveEasyChat * Save_EasyChat_Get(struct SaveData * save); BOOL sub_02013B68(struct SaveEasyChat * unk, u32 a1); -s32 sub_02013B74(struct SaveEasyChat * unk); -BOOL sub_02013BC8(struct SaveEasyChat * unk); -u16 sub_02013BE4(u16 a0); +u32 Save_EasyChat_RandomTrendySayingSet(struct SaveEasyChat * unk); +BOOL Save_EasyChat_TrendySayingsUnlockedAllCheck(struct SaveEasyChat * unk); +u16 TrendyWordIdxToECWord(u32 a0); BOOL sub_02013C0C(struct SaveEasyChat * unk, u32 a1); void sub_02013C18(struct SaveEasyChat * unk, u32 a1); s32 sub_02013C28(u16 a0); diff --git a/include/unk_0204B0A0.h b/include/unk_0204B0A0.h index 7ad5555e0..b26056fb7 100644 --- a/include/unk_0204B0A0.h +++ b/include/unk_0204B0A0.h @@ -3,7 +3,7 @@ #include "RTC_api.h" #include "RTC_convert.h" -#include "sav_system_info.h" +#include "save_system_info.h" #include "script.h" void sub_0204B0F8(struct FieldSystem *fieldSystem); diff --git a/include/unk_0208890C.h b/include/unk_0208890C.h index 7927c218b..51ceb421e 100644 --- a/include/unk_0208890C.h +++ b/include/unk_0208890C.h @@ -11,7 +11,7 @@ struct SaveData; typedef struct PoffinCaseAppData { u8 padding[0x4]; u32 unk4; - u32 unk8; + SavePoffinData *savePoffinData; struct SaveData* save; PlayerProfile* player; struct Bag* bag; From a1c421f50160fe7264e360827989bb439de18517 Mon Sep 17 00:00:00 2001 From: red031000 Date: Fri, 30 Jun 2023 21:24:53 +0100 Subject: [PATCH 7/7] complete scrcmd --- arm9/arm9.lsf | 1 - arm9/asm/scrcmd_asm.s | 763 --------------------------- arm9/asm/unk_02034D7C.s | 4 +- arm9/asm/unk_020377F0.s | 2 +- arm9/asm/unk_02038C78.s | 16 +- arm9/asm/unk_02048120.s | 2 +- arm9/asm/unk_020484A8.s | 2 +- arm9/asm/unk_02048904.s | 8 +- arm9/asm/unk_0205F7A0.s | 2 +- arm9/asm/unk_02064E90.s | 6 +- arm9/asm/unk_0207D5BC.s | 2 +- arm9/global.inc | 34 +- arm9/overlays/05/asm/ov05_021D80E8.s | 2 +- arm9/overlays/05/asm/ov05_021E8310.s | 16 +- arm9/overlays/06/asm/overlay_06.s | 2 +- arm9/overlays/42/asm/overlay_42.s | 4 +- arm9/overlays/43/asm/overlay_43.s | 4 +- arm9/overlays/69/asm/overlay_69.s | 2 +- arm9/overlays/83/asm/overlay_83.s | 2 +- arm9/src/nutdata.c | 5 +- arm9/src/pokemon.c | 2 +- arm9/src/pokemon_storage_system.c | 3 +- arm9/src/save_system_info.c | 8 +- arm9/src/scrcmd.c | 283 +++++++++- arm9/src/scrcmd_names.c | 4 +- arm9/src/trainer_data.c | 3 +- arm9/src/unk_02021934.c | 2 +- arm9/src/unk_02022504.c | 8 +- arm9/src/unk_0202A1E0.c | 3 +- arm9/src/unk_02064E4C.c | 4 +- include/hall_of_fame.h | 1 + include/save_system_info.h | 6 +- include/scrcmd.h | 25 + include/script.h | 4 + include/string16.h | 2 +- include/unk_02022504.h | 5 +- 36 files changed, 396 insertions(+), 846 deletions(-) delete mode 100644 arm9/asm/scrcmd_asm.s diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index de9910dd6..98e776299 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -157,7 +157,6 @@ Static arm9 Object script.o Object unk_02038C78.o Object scrcmd.o - Object scrcmd_asm.o Object scrcmd_mart.o Object scrcmd_3.o Object scrcmd_names.o diff --git a/arm9/asm/scrcmd_asm.s b/arm9/asm/scrcmd_asm.s deleted file mode 100644 index bb1462cae..000000000 --- a/arm9/asm/scrcmd_asm.s +++ /dev/null @@ -1,763 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .extern UNK_020F34FC - .extern UNK_020F3538 - .extern gSystem - .extern sub_0203BB90 - .extern sub_0203BC04 - - .text - - thumb_func_start ScrCmd_Unk028A -ScrCmd_Unk028A: ; 0x0203F6E4 - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r4, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl Save_PoffinData_Get - bl sub_02028074 - ldr r1, _0203F71C ; =0x0000FFFF - cmp r0, r1 - bne _0203F712 - mov r0, #0x0 - b _0203F714 -_0203F712: - mov r0, #0x1 -_0203F714: - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - nop -_0203F71C: .word 0x0000FFFF - - thumb_func_start ScrCmd_Unk028B -ScrCmd_Unk028B: ; 0x0203F720 - push {r4-r6, lr} - add r5, r0, #0x0 - ldr r2, [r5, #0x8] - add r1, r2, #0x1 - str r1, [r5, #0x8] - ldrb r4, [r2, #0x0] - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r6, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - add r5, r0, #0x0 - cmp r4, #0x3 - bls _0203F752 - bl GF_AssertFail -_0203F752: - add r0, r5, #0x0 - add r1, r4, #0x0 - bl sub_0205F4A0 - strh r0, [r6, #0x0] - mov r0, #0x0 - pop {r4-r6, pc} - - thumb_func_start ScrCmd_Unk028F -ScrCmd_Unk028F: ; 0x0203F760 - push {r3-r5, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r4, #0x80 - add r5, r0, #0x0 - ldr r0, [r4, #0x0] - mov r1, #0x20 - ldr r0, [r0, #0xc] - add r2, sp, #0x0 - bl LoadHallOfFame - ldr r1, [sp, #0x0] - add r4, r0, #0x0 - cmp r1, #0x0 - bne _0203F798 - mov r1, #0x0 - strh r1, [r5, #0x0] - bl FreeToHeap - mov r0, #0x1 - pop {r3-r5, pc} -_0203F798: - cmp r1, #0x1 - bne _0203F7AE - mov r1, #0x0 - bl Save_HOF_TranslateRecordIdx - strh r0, [r5, #0x0] - add r0, r4, #0x0 - bl FreeToHeap - mov r0, #0x1 - pop {r3-r5, pc} -_0203F7AE: - cmp r1, #0x2 - bne _0203F7BE - mov r1, #0x0 - strh r1, [r5, #0x0] - bl FreeToHeap - mov r0, #0x1 - pop {r3-r5, pc} -_0203F7BE: - mov r0, #0x0 - strh r0, [r5, #0x0] - mov r0, #0x1 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk0290 -ScrCmd_Unk0290: ; 0x0203F7C8 - push {r4-r6, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r6, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0x13 - bl FieldSysGetAttrAddr - add r1, r5, #0x0 - add r1, #0x80 - add r4, r0, #0x0 - ldr r1, [r1, #0x0] - mov r0, #0x20 - add r2, r6, #0x0 - bl sub_02037A48 - str r0, [r4, #0x0] - ldr r1, _0203F808 ; =sub_0203BC04 - add r0, r5, #0x0 - bl SetupNativeScript - mov r0, #0x1 - pop {r4-r6, pc} - .balign 4 -_0203F808: .word sub_0203BC04 - - thumb_func_start ScrCmd_Unk0291 -ScrCmd_Unk0291: ; 0x0203F80C - push {r4-r6, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r6, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r4, #0x80 - add r5, r0, #0x0 - ldr r0, [r4, #0x0] - mov r1, #0x13 - bl FieldSysGetAttrAddr - add r4, r0, #0x0 - ldr r0, [r4, #0x0] - cmp r0, #0x0 - bne _0203F84C - bl GF_AssertFail -_0203F84C: - ldr r0, [r4, #0x0] - bl sub_02037A40 - strh r0, [r6, #0x0] - ldrh r0, [r6, #0x0] - cmp r0, #0x7 - bne _0203F85E - mov r0, #0xff - strh r0, [r6, #0x0] -_0203F85E: - ldr r0, [r4, #0x0] - bl sub_02037A70 - strh r0, [r5, #0x0] - ldrh r0, [r5, #0x0] - cmp r0, #0x1 - bne _0203F870 - mov r0, #0x1 - b _0203F872 -_0203F870: - mov r0, #0x0 -_0203F872: - strh r0, [r5, #0x0] - ldr r0, [r4, #0x0] - bl FreeToHeap - mov r0, #0x0 - str r0, [r4, #0x0] - pop {r4-r6, pc} - - thumb_func_start ScrCmd_Unk0292 -ScrCmd_Unk0292: ; 0x0203F880 - push {r3-r5, lr} - add r5, r0, #0x0 - ldr r2, [r5, #0x8] - add r1, r2, #0x1 - str r1, [r5, #0x8] - ldrb r4, [r2, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - cmp r4, #0x64 - bls _0203F8A2 - mov r4, #0x64 -_0203F8A2: - bl LCRandom - mov r1, #0x65 - bl _s32_div_f - lsl r0, r1, #0x10 - lsr r0, r0, #0x10 - cmp r0, r4 - bgt _0203F8B8 - mov r0, #0x1 - b _0203F8BA -_0203F8B8: - mov r0, #0x0 -_0203F8BA: - strh r0, [r5, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - - thumb_func_start ScrCmd_Unk029E -ScrCmd_Unk029E: ; 0x0203F8C0 - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - cmp r4, #0x0 - beq _0203F8FC - cmp r4, #0x1 - beq _0203F906 - cmp r4, #0x2 - beq _0203F910 - b _0203F91A -_0203F8FC: - mov r2, #0x0 - mov r3, #0x20 - bl ov06_0224F12C - b _0203F91E -_0203F906: - mov r2, #0x1 - mov r3, #0x20 - bl ov06_0224F12C - b _0203F91E -_0203F910: - mov r2, #0x2 - mov r3, #0x20 - bl ov06_0224F12C - b _0203F91E -_0203F91A: - bl GF_AssertFail -_0203F91E: - mov r0, #0x1 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk0293 -ScrCmd_Unk0293: ; 0x0203F924 - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - add r0, r4, #0x0 - bl sub_0205F6A8 - strh r0, [r5, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk029F -ScrCmd_Unk029F: ; 0x0203F954 - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - cmp r0, #0x0 - bne _0203F978 - add r4, #0x80 - ldr r0, [r4, #0x0] - ldr r0, [r0, #0x10] - bl ov06_02239944 - b _0203F982 -_0203F978: - add r4, #0x80 - ldr r0, [r4, #0x0] - ldr r0, [r0, #0x10] - bl ov06_02239AAC -_0203F982: - mov r0, #0x1 - pop {r4, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk02A3 -ScrCmd_Unk02A3: ; 0x0203F988 - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r4, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl sub_0203384C - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk02A4 -ScrCmd_Unk02A4: ; 0x0203F9B0 - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r4, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl sub_020286EC - bl sub_02028448 - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk02A2 -ScrCmd_Unk02A2: ; 0x0203F9DC - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r5, #0x80 - add r4, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl sub_02026CC4 - ldr r1, _0203FA10 ; =0x0000FF79 - add r1, r4, r1 - lsl r1, r1, #0x10 - lsr r1, r1, #0x10 - cmp r1, #0x1 - bhi _0203FA0C - bl sub_02025C30 -_0203FA0C: - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 -_0203FA10: .word 0x0000FF79 - - thumb_func_start ScrCmd_Unk02A7 -ScrCmd_Unk02A7: ; 0x0203FA14 - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - mov r1, #0x0 - strh r1, [r0, #0x0] - ldr r1, _0203FA54 ; =0x0000012A - cmp r4, r1 - blo _0203FA4E - add r1, #0xf - cmp r4, r1 - bhi _0203FA4E - mov r1, #0x1 - strh r1, [r0, #0x0] -_0203FA4E: - mov r0, #0x0 - pop {r3-r5, pc} - nop -_0203FA54: .word 0x0000012A - - thumb_func_start ScrCmd_Unk02AA -ScrCmd_Unk02AA: ; 0x0203FA58 - push {r3-r7, lr} - sub sp, #0x10 - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r6, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - str r0, [sp, #0x4] - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - str r0, [sp, #0x8] - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - str r0, [sp, #0xc] - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl VarGet - add r7, r0, #0x0 - mov r0, #0x20 - bl MessageFormat_New - add r4, r0, #0x0 - ldr r2, _0203FB48 ; =0x00000147 - mov r0, #0x0 - mov r1, #0x1a - mov r3, #0x20 - bl NewMsgDataFromNarc - add r5, r0, #0x0 - ldr r2, [sp, #0x4] - add r0, r4, #0x0 - mov r1, #0x0 - bl BufferECWord - ldr r2, [sp, #0x8] - add r0, r4, #0x0 - mov r1, #0x1 - bl BufferECWord - ldr r2, [sp, #0xc] - add r0, r4, #0x0 - mov r1, #0x2 - bl BufferECWord - add r0, r4, #0x0 - mov r1, #0x3 - add r2, r7, #0x0 - bl BufferECWord - add r0, r4, #0x0 - add r1, r5, #0x0 - mov r2, #0x1 - mov r3, #0x20 - bl ReadMsgData_ExpandPlaceholders - add r7, r0, #0x0 - add r0, r5, #0x0 - mov r1, #0x0 - bl NewString_ReadMsgData - str r0, [sp, #0x0] - ldr r1, [sp, #0x0] - add r0, r7, #0x0 - bl StringCompare - cmp r0, #0x0 - bne _0203FB24 - mov r0, #0x1 - b _0203FB26 -_0203FB24: - mov r0, #0x0 -_0203FB26: - strh r0, [r6, #0x0] - add r0, r7, #0x0 - bl String_Delete - ldr r0, [sp, #0x0] - bl String_Delete - add r0, r5, #0x0 - bl DestroyMsgData - add r0, r4, #0x0 - bl MessageFormat_Delete - mov r0, #0x0 - add sp, #0x10 - pop {r3-r7, pc} - nop -_0203FB48: .word 0x00000147 - - thumb_func_start ScrCmd_Unk02AC -ScrCmd_Unk02AC: ; 0x0203FB4C - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Save_SysInfo_Get - mov r1, #0x1 - bl sub_02023828 - mov r0, #0x0 - pop {r3, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk02AF -ScrCmd_Unk02AF: ; 0x0203FB64 - push {r3-r5, lr} - add r5, r0, #0x0 - add r1, r5, #0x0 - add r1, #0x80 - ldr r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - add r0, r4, #0x0 - mov r1, #0xf - bl FieldSysGetAttrAddr - ldr r0, [r0, #0x0] - bl sub_0205296C - strh r0, [r5, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk02B0 -ScrCmd_Unk02B0: ; 0x0203FB94 - push {r3, lr} - bl sub_02033E74 - mov r0, #0x0 - pop {r3, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk02B1 -ScrCmd_Unk02B1: ; 0x0203FBA0 - push {r3, lr} - bl sub_02033ED0 - mov r0, #0x0 - pop {r3, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk02B2 -ScrCmd_Unk02B2: ; 0x0203FBAC - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - bl sub_02034E48 - mov r0, #0x0 - pop {r3, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk02B5 -ScrCmd_Unk02B5: ; 0x0203FBBC - push {r3-r7, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r6, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r5, #0x80 - add r7, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl Save_LocalFieldData_Get - bl sub_02034DCC - str r4, [r0, #0x0] - str r6, [r0, #0x8] - mov r1, #0x0 - str r7, [r0, #0xc] - mvn r1, r1 - str r1, [r0, #0x4] - mov r1, #0x1 - str r1, [r0, #0x10] - mov r0, #0x0 - pop {r3-r7, pc} - - thumb_func_start ScrCmd_Unk02B6 -ScrCmd_Unk02B6: ; 0x0203FC1C - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - ldr r2, [r5, #0x8] - add r1, r0, #0x0 - add r0, r2, #0x1 - str r0, [r5, #0x8] - add r5, #0x80 - ldr r0, [r5, #0x0] - ldrb r4, [r2, #0x0] - ldr r0, [r0, #0x34] - bl GetMapObjectByID - add r5, r0, #0x0 - bne _0203FC4C - bl GF_AssertFail -_0203FC4C: - add r0, r5, #0x0 - add r1, r4, #0x0 - bl sub_020588B8 - mov r0, #0x0 - pop {r3-r5, pc} - - thumb_func_start ScrCmd_Unk02BE -ScrCmd_Unk02BE: ; 0x0203FC58 - push {r3-r5, lr} - add r5, r0, #0x0 - add r1, r5, #0x0 - add r1, #0x80 - ldr r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - add r0, r4, #0x0 - bl sub_02065078 - strh r0, [r5, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk02C1 -ScrCmd_Unk02C1: ; 0x0203FC80 - push {r3-r5, lr} - add r0, #0x80 - ldr r5, [r0, #0x0] - mov r1, #0x28 - add r0, r5, #0x0 - bl FieldSysGetAttrAddr - add r4, r0, #0x0 - ldr r0, [r5, #0xc] - bl Save_FileDoesNotBelongToPlayer - cmp r0, #0x0 - bne _0203FCAA - add r0, r5, #0x0 - mov r1, #0x4 - mov r2, #0x3 - bl ov05_021E8588 - str r0, [r4, #0x0] - bl ov05_021E84F4 -_0203FCAA: - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk02C2 -ScrCmd_Unk02C2: ; 0x0203FCB0 - push {r3-r5, lr} - add r0, #0x80 - ldr r5, [r0, #0x0] - mov r1, #0x28 - add r0, r5, #0x0 - bl FieldSysGetAttrAddr - add r4, r0, #0x0 - ldr r0, [r5, #0xc] - bl Save_FileDoesNotBelongToPlayer - cmp r0, #0x0 - bne _0203FCD6 - ldr r0, [r4, #0x0] - bl ov05_021E856C - ldr r0, [r4, #0x0] - bl ov05_021E85E4 -_0203FCD6: - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start ScrCmd_Unk02C3 -ScrCmd_Unk02C3: ; 0x0203FCDC - push {r3, lr} - ldr r2, [r0, #0x8] - add r1, r2, #0x1 - str r1, [r0, #0x8] - add r0, #0x80 - ldrb r1, [r2, #0x0] - ldr r0, [r0, #0x0] - bl sub_0206367C - mov r0, #0x0 - pop {r3, pc} - .balign 4 diff --git a/arm9/asm/unk_02034D7C.s b/arm9/asm/unk_02034D7C.s index 3593f2eb1..32f67fcf3 100644 --- a/arm9/asm/unk_02034D7C.s +++ b/arm9/asm/unk_02034D7C.s @@ -60,8 +60,8 @@ sub_02034DC8: ; 0x02034DC8 add r0, #0x28 bx lr - thumb_func_start sub_02034DCC -sub_02034DCC: ; 0x02034DCC + thumb_func_start LocalFieldData_GetSpecialSpawnWarpPtr +LocalFieldData_GetSpecialSpawnWarpPtr: ; 0x02034DCC add r0, #0x50 bx lr diff --git a/arm9/asm/unk_020377F0.s b/arm9/asm/unk_020377F0.s index 5c9d5af85..a78031735 100644 --- a/arm9/asm/unk_020377F0.s +++ b/arm9/asm/unk_020377F0.s @@ -1849,7 +1849,7 @@ _020384D6: bne _020384F2 ldr r0, [r1, #0x18] ldr r1, [r4, #0x10] - bl StringCompare + bl String_Compare cmp r0, #0x0 bne _02038514 ldr r0, [r4, #0xc] diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index f0dc1a277..badfe20ab 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -800,7 +800,7 @@ gScriptCmdTable: ; 0x020F355C .word ScrCmd_Unk0288 .word ScrCmd_Unk0289 .word ScrCmd_Unk028A - .word ScrCmd_Unk028B + .word ScrCmd_CheckEventValidity .word ScrCmd_ShowPartyPokemonPic .word ScrCmd_Unk028D .word ScrCmd_Unk028E @@ -820,7 +820,7 @@ gScriptCmdTable: ; 0x020F355C .word ScrCmd_Unk029C .word ScrCmd_Unk029D .word ScrCmd_Unk029E - .word ScrCmd_Unk029F + .word ScrCmd_ShakeCamera .word ScrCmd_Unk02A0 .word ScrCmd_Unk02A1 .word ScrCmd_Unk02A2 @@ -831,9 +831,9 @@ gScriptCmdTable: ; 0x020F355C .word ScrCmd_Unk02A7 .word ScrCmd_TakeCoinsAddress .word ScrCmd_HasEnoughCoinsAddress - .word ScrCmd_Unk02AA + .word ScrCmd_CompareMysteryGiftEasyChatInput .word ScrCmd_Unk02AB - .word ScrCmd_Unk02AC + .word ScrCmd_ActivateMysteryGift .word ScrCmd_GetEventMovement .word ScrCmd_Unk02AE .word ScrCmd_Unk02AF @@ -851,12 +851,12 @@ gScriptCmdTable: ; 0x020F355C .word ScrCmd_Unk02BB .word ScrCmd_Unk02BC .word ScrCmd_LegendaryBattle - .word ScrCmd_Unk02BE + .word ScrCmd_GetTrainerCardLevel .word ScrCmd_DummyRideBike .word ScrCmd_Unk02C0 - .word ScrCmd_Unk02C1 - .word ScrCmd_Unk02C2 - .word ScrCmd_Unk02C3 + .word ScrCmd_ShowSaveStats + .word ScrCmd_HideSaveStats + .word ScrCmd_ScopeMode .word ScrCmd_GetItemNameWithIndefArticle .word ScrCmd_GetItemNamePlural .word ScrCmd_GetDecorationNameWithArticle diff --git a/arm9/asm/unk_02048120.s b/arm9/asm/unk_02048120.s index 2085919c1..1f376e792 100644 --- a/arm9/asm/unk_02048120.s +++ b/arm9/asm/unk_02048120.s @@ -341,7 +341,7 @@ _020483B0: str r0, [sp, #0x0] bl sub_02034EC4 add r0, r7, #0x0 - bl sub_02034DCC + bl LocalFieldData_GetSpecialSpawnWarpPtr add r1, r0, #0x0 ldr r0, [sp, #0x0] bl sub_02034E90 diff --git a/arm9/asm/unk_020484A8.s b/arm9/asm/unk_020484A8.s index 72074f9be..a9a5ac4e1 100644 --- a/arm9/asm/unk_020484A8.s +++ b/arm9/asm/unk_020484A8.s @@ -276,7 +276,7 @@ CallTask_GameClear: ; 0x02048694 str r0, [sp, #0x8] ldr r0, [r4, #0xc] bl Save_LocalFieldData_Get - bl sub_02034DCC + bl LocalFieldData_GetSpecialSpawnWarpPtr str r0, [sp, #0x4] add r0, r6, #0x0 bl sub_0205ED0C diff --git a/arm9/asm/unk_02048904.s b/arm9/asm/unk_02048904.s index 40514d9e8..a782f4322 100644 --- a/arm9/asm/unk_02048904.s +++ b/arm9/asm/unk_02048904.s @@ -2096,9 +2096,9 @@ _02049976: add r0, r5, #0x0 mov r1, #0xb mov r2, #0x3 - bl ov05_021E8588 + bl Field_SaveStatsPrinter_New str r0, [r4, #0x20] - bl ov05_021E84F4 + bl Field_SaveStatsPrinter_Print add r3, r4, #0x0 mov r2, #0x0 ldr r1, _02049AC4 ; =0x000007D5 @@ -2120,9 +2120,9 @@ _020499A2: b _02049AB2 _020499B2: ldr r0, [r4, #0x20] - bl ov05_021E856C + bl Field_SaveStatsPrinter_RemoveFromScreen ldr r0, [r4, #0x20] - bl ov05_021E85E4 + bl Field_SaveStatsPrinter_Delete ldrh r0, [r4, #0x1c] cmp r0, #0x0 bne _020499CA diff --git a/arm9/asm/unk_0205F7A0.s b/arm9/asm/unk_0205F7A0.s index 9dfa158e9..6f36b15a2 100644 --- a/arm9/asm/unk_0205F7A0.s +++ b/arm9/asm/unk_0205F7A0.s @@ -29,7 +29,7 @@ sub_0205F7A0: ; 0x0205F7A0 ldr r0, [sp, #0x0] ldr r0, [r0, #0xc] bl Save_LocalFieldData_Get - bl sub_02034DCC + bl LocalFieldData_GetSpecialSpawnWarpPtr mov r2, #0x5 str r0, [sp, #0xc] add r0, r5, #0x0 diff --git a/arm9/asm/unk_02064E90.s b/arm9/asm/unk_02064E90.s index 2e9474491..e3143bb0b 100644 --- a/arm9/asm/unk_02064E90.s +++ b/arm9/asm/unk_02064E90.s @@ -24,7 +24,7 @@ sub_02064E90: ; 0x02064E90 ldr r0, [sp, #0x1c] strb r0, [r5, #0x5] add r0, r6, #0x0 - bl sub_02065078 + bl GetTrainerCardLevel str r0, [sp, #0x24] add r0, r7, #0x0 bl PlayerProfile_GetLanguage @@ -215,8 +215,8 @@ sub_02065070: ; 0x02065070 .balign 4 _02065074: .word FreeToHeap - thumb_func_start sub_02065078 -sub_02065078: ; 0x02065078 + thumb_func_start GetTrainerCardLevel +GetTrainerCardLevel: ; 0x02065078 push {r3-r7, lr} bl FieldSystem_GetSaveDataPtr add r7, r0, #0x0 diff --git a/arm9/asm/unk_0207D5BC.s b/arm9/asm/unk_0207D5BC.s index b263f5f2c..b15b66e19 100644 --- a/arm9/asm/unk_0207D5BC.s +++ b/arm9/asm/unk_0207D5BC.s @@ -543,7 +543,7 @@ sub_0207D958: ; 0x0207D958 add r3, #0xc ldr r0, [r1, r3] ldr r1, [r1, r2] - bl StringCompare + bl String_Compare cmp r0, #0x0 bne _0207D98E mov r0, #0x1 diff --git a/arm9/global.inc b/arm9/global.inc index fdeb06bed..ff0f589b8 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -1395,7 +1395,7 @@ .extern StringDup .extern String16_FormatInteger .extern String_atoi -.extern StringCompare +.extern String_Compare .extern StringGetLength .extern StringCountLines .extern StringGetLineN @@ -1461,8 +1461,8 @@ .extern Save_SysInfo_RTCOffsetIsMine .extern Save_SysInfo_GetBirthMonth .extern Save_SysInfo_GetBirthDay -.extern sub_02023820 -.extern sub_02023828 +.extern Save_SysInfo_GetMysteryGiftActive +.extern Save_SysInfo_SetMysteryGiftActive .extern sub_02023830 .extern sub_02023834 .extern Save_SysInfo_RTC_Init @@ -2550,7 +2550,7 @@ .extern sub_02034DC0 .extern sub_02034DC4 .extern sub_02034DC8 -.extern sub_02034DCC +.extern LocalFieldData_GetSpecialSpawnWarpPtr .extern LocalFieldData_GetDynamicWarp .extern LocalFieldData_SetDynamicWarp .extern sub_02034DE8 @@ -3093,30 +3093,30 @@ .extern ScrCmd_Unk0288 .extern ScrCmd_Unk0289 .extern ScrCmd_Unk028A -.extern ScrCmd_Unk028B +.extern ScrCmd_CheckEventValidity .extern ScrCmd_Unk028F .extern ScrCmd_Unk0290 .extern ScrCmd_Unk0291 .extern ScrCmd_Unk0292 .extern ScrCmd_Unk029E .extern ScrCmd_Unk0293 -.extern ScrCmd_Unk029F +.extern ScrCmd_ShakeCamera .extern ScrCmd_Unk02A3 .extern ScrCmd_Unk02A4 .extern ScrCmd_Unk02A2 .extern ScrCmd_Unk02A7 -.extern ScrCmd_Unk02AA -.extern ScrCmd_Unk02AC +.extern ScrCmd_CompareMysteryGiftEasyChatInput +.extern ScrCmd_ActivateMysteryGift .extern ScrCmd_Unk02AF .extern ScrCmd_Unk02B0 .extern ScrCmd_Unk02B1 .extern ScrCmd_Unk02B2 .extern ScrCmd_Unk02B5 .extern ScrCmd_Unk02B6 -.extern ScrCmd_Unk02BE -.extern ScrCmd_Unk02C1 -.extern ScrCmd_Unk02C2 -.extern ScrCmd_Unk02C3 +.extern ScrCmd_GetTrainerCardLevel +.extern ScrCmd_ShowSaveStats +.extern ScrCmd_HideSaveStats +.extern ScrCmd_ScopeMode .extern ScrCmd_NormalMart .extern ScrCmd_SpecialMart .extern ScrCmd_GoodsMart @@ -4721,7 +4721,7 @@ .extern sub_02064E90 .extern sub_02065054 .extern sub_02065070 -.extern sub_02065078 +.extern GetTrainerCardLevel .extern sub_02065314 .extern sub_02065344 .extern sub_02066818 @@ -6723,10 +6723,10 @@ .extern ov05_021E8148 .extern ov05_021E8158 .extern ov05_021E81BC -.extern ov05_021E84F4 -.extern ov05_021E856C -.extern ov05_021E8588 -.extern ov05_021E85E4 +.extern Field_SaveStatsPrinter_Print +.extern Field_SaveStatsPrinter_RemoveFromScreen +.extern Field_SaveStatsPrinter_New +.extern Field_SaveStatsPrinter_Delete .extern Field_SaveGame .extern ov05_021E8648 .extern ov05_021E8698 diff --git a/arm9/overlays/05/asm/ov05_021D80E8.s b/arm9/overlays/05/asm/ov05_021D80E8.s index 0f0f85c5a..2d1a4c54f 100644 --- a/arm9/overlays/05/asm/ov05_021D80E8.s +++ b/arm9/overlays/05/asm/ov05_021D80E8.s @@ -2170,7 +2170,7 @@ ov05_021D9248: ; 0x021D9248 str r2, [sp] add r4, r3, #0 bl Save_LocalFieldData_Get - bl sub_02034DCC + bl LocalFieldData_GetSpecialSpawnWarpPtr add r6, r0, #0 ldr r3, [r5, #0x1c] add r2, r6, #0 diff --git a/arm9/overlays/05/asm/ov05_021E8310.s b/arm9/overlays/05/asm/ov05_021E8310.s index 6b9e4b765..be16c3f01 100644 --- a/arm9/overlays/05/asm/ov05_021E8310.s +++ b/arm9/overlays/05/asm/ov05_021E8310.s @@ -238,8 +238,8 @@ _021E84D6: _021E84EC: .word ov05_021F78D4 _021E84F0: .word ov05_021F78C4 - thumb_func_start ov05_021E84F4 -ov05_021E84F4: ; 0x021E84F4 + thumb_func_start Field_SaveStatsPrinter_Print +Field_SaveStatsPrinter_Print: ; 0x021E84F4 push {r3, r4, lr} sub sp, #0x14 add r4, r0, #0 @@ -293,8 +293,8 @@ ov05_021E84F4: ; 0x021E84F4 _021E8564: .word 0x0000027F _021E8568: .word 0x000003D9 - thumb_func_start ov05_021E856C -ov05_021E856C: ; 0x021E856C + thumb_func_start Field_SaveStatsPrinter_RemoveFromScreen +Field_SaveStatsPrinter_RemoveFromScreen: ; 0x021E856C push {r4, lr} add r4, r0, #0 ldr r0, [r4, #0x10] @@ -307,8 +307,8 @@ ov05_021E856C: ; 0x021E856C pop {r4, pc} .balign 4, 0 - thumb_func_start ov05_021E8588 -ov05_021E8588: ; 0x021E8588 + thumb_func_start Field_SaveStatsPrinter_New +Field_SaveStatsPrinter_New: ; 0x021E8588 push {r3, r4, r5, r6, r7, lr} add r5, r1, #0 add r6, r0, #0 @@ -350,8 +350,8 @@ ov05_021E8588: ; 0x021E8588 .balign 4, 0 _021E85E0: .word 0x000001E3 - thumb_func_start ov05_021E85E4 -ov05_021E85E4: ; 0x021E85E4 + thumb_func_start Field_SaveStatsPrinter_Delete +Field_SaveStatsPrinter_Delete: ; 0x021E85E4 push {r4, lr} add r4, r0, #0 ldr r0, [r4, #0x18] diff --git a/arm9/overlays/06/asm/overlay_06.s b/arm9/overlays/06/asm/overlay_06.s index 0a8164481..5ea8ef3de 100644 --- a/arm9/overlays/06/asm/overlay_06.s +++ b/arm9/overlays/06/asm/overlay_06.s @@ -39288,7 +39288,7 @@ ov06_0224C888: ; 0x0224C888 bl sub_02049494 b _0224C8C0 _0224C8B2: - bl sub_02034DCC + bl LocalFieldData_GetSpecialSpawnWarpPtr add r1, r0, #0 ldr r2, [r4, #8] add r0, r5, #0 diff --git a/arm9/overlays/42/asm/overlay_42.s b/arm9/overlays/42/asm/overlay_42.s index e4fd48558..50b7e27c3 100644 --- a/arm9/overlays/42/asm/overlay_42.s +++ b/arm9/overlays/42/asm/overlay_42.s @@ -135,7 +135,7 @@ _02254932: add r4, r0, #0 ldr r0, [r4, #0xc] bl Save_LocalFieldData_Get - bl sub_02034DCC + bl LocalFieldData_GetSpecialSpawnWarpPtr add r6, r0, #0 ldr r0, [r4, #0x1c] ldr r0, [r0] @@ -523,7 +523,7 @@ ov42_02254C04: ; 0x02254C04 add r4, r0, #0 ldr r0, [r4, #0xc] bl Save_LocalFieldData_Get - bl sub_02034DCC + bl LocalFieldData_GetSpecialSpawnWarpPtr add r6, r0, #0 ldr r0, [r4, #0x1c] ldr r0, [r0] diff --git a/arm9/overlays/43/asm/overlay_43.s b/arm9/overlays/43/asm/overlay_43.s index 695abf4b8..9473fa186 100644 --- a/arm9/overlays/43/asm/overlay_43.s +++ b/arm9/overlays/43/asm/overlay_43.s @@ -58,7 +58,7 @@ ov43_0225489C: ; 0x0225489C add r4, r0, #0 ldr r0, [r4, #0xc] bl Save_LocalFieldData_Get - bl sub_02034DCC + bl LocalFieldData_GetSpecialSpawnWarpPtr add r6, r0, #0 ldr r0, [r4, #0x1c] ldr r0, [r0] @@ -391,7 +391,7 @@ ov43_02254AF8: ; 0x02254AF8 add r4, r0, #0 ldr r0, [r4, #0xc] bl Save_LocalFieldData_Get - bl sub_02034DCC + bl LocalFieldData_GetSpecialSpawnWarpPtr add r7, r0, #0 ldr r0, [r4, #0x1c] ldr r0, [r0] diff --git a/arm9/overlays/69/asm/overlay_69.s b/arm9/overlays/69/asm/overlay_69.s index e62c730ad..d5b04c54b 100644 --- a/arm9/overlays/69/asm/overlay_69.s +++ b/arm9/overlays/69/asm/overlay_69.s @@ -4094,7 +4094,7 @@ _0222F726: ldr r0, [r5, r1] add r1, r1, #4 ldr r1, [r5, r1] - bl StringCompare + bl String_Compare cmp r0, #0 beq _0222F750 mov r5, #2 diff --git a/arm9/overlays/83/asm/overlay_83.s b/arm9/overlays/83/asm/overlay_83.s index 89aa23b98..87fb2c5f2 100644 --- a/arm9/overlays/83/asm/overlay_83.s +++ b/arm9/overlays/83/asm/overlay_83.s @@ -1241,7 +1241,7 @@ ov83_0222DF40: ; 0x0222DF40 _0222DF60: ldr r0, [r5, #4] bl Save_SysInfo_Get - bl sub_02023820 + bl Save_SysInfo_GetMysteryGiftActive cmp r0, #1 bne _0222DF72 mov r0, #1 diff --git a/arm9/src/nutdata.c b/arm9/src/nutdata.c index 7321433e7..baafc38c7 100644 --- a/arm9/src/nutdata.c +++ b/arm9/src/nutdata.c @@ -4,6 +4,7 @@ #include "filesystem.h" #include "nutdata.h" #include "msgdata.h" +#include "msgdata/msg.naix" #include "constants/items.h" NARC * OpenNutsDataNarc(HeapID heapId) @@ -64,7 +65,7 @@ u32 GetNutAttr(struct NutData * nut, u32 attr) struct String * GetNutName(u32 berry_idx, HeapID heapId) { - struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, 373, heapId); + struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0373_bin, heapId); struct String * ret = NewString_ReadMsgData(msgData, berry_idx); DestroyMsgData(msgData); return ret; @@ -72,7 +73,7 @@ struct String * GetNutName(u32 berry_idx, HeapID heapId) struct String * GetNutDesc(u32 berry_idx, HeapID heapId) { - struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, 372, heapId); + struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0372_bin, heapId); struct String * ret = NewString_ReadMsgData(msgData, berry_idx); DestroyMsgData(msgData); return ret; diff --git a/arm9/src/pokemon.c b/arm9/src/pokemon.c index 5b82bb4ca..9781112df 100644 --- a/arm9/src/pokemon.c +++ b/arm9/src/pokemon.c @@ -3690,7 +3690,7 @@ BOOL sub_0206A9AC(struct BoxPokemon * boxmon, PlayerProfile * sb2, HeapID heapId struct String * r6 = String_New(PLAYER_NAME_LENGTH + 1, heapId); BOOL ret = FALSE; GetBoxMonData(boxmon, MON_DATA_OT_NAME_2, r6); - if (myId == otId && myGender == otGender && StringCompare(r7, r6) == 0) + if (myId == otId && myGender == otGender && String_Compare(r7, r6) == 0) ret = TRUE; String_Delete(r6); String_Delete(r7); diff --git a/arm9/src/pokemon_storage_system.c b/arm9/src/pokemon_storage_system.c index da568301a..55dd00e40 100644 --- a/arm9/src/pokemon_storage_system.c +++ b/arm9/src/pokemon_storage_system.c @@ -3,6 +3,7 @@ #include "save.h" #include "pokemon_storage_system.h" #include "msgdata.h" +#include "msgdata/msg.naix" #include "string16.h" void PCStorage_Init(struct PCStorage * pc) @@ -34,7 +35,7 @@ void PCStorage_InitializeBoxes(struct PCStorage * pc) j = 0; } pc->unlockedWallpapers = 0; - struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, 14, HEAP_ID_DEFAULT); + struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0014_bin, HEAP_ID_DEFAULT); if (msgData != NULL) { for (i = 0; i < NUM_BOXES; i++) diff --git a/arm9/src/save_system_info.c b/arm9/src/save_system_info.c index 209683073..e048c79cd 100644 --- a/arm9/src/save_system_info.c +++ b/arm9/src/save_system_info.c @@ -66,14 +66,14 @@ u8 Save_SysInfo_GetBirthDay(struct SaveSysInfo * unk) return unk->birthDay; } -u8 sub_02023820(struct SaveSysInfo * unk) +u8 Save_SysInfo_GetMysteryGiftActive(struct SaveSysInfo * unk) { - return unk->field_48; + return unk->mysteryGiftActive; } -void sub_02023828(struct SaveSysInfo * unk, u8 val) +void Save_SysInfo_SetMysteryGiftActive(struct SaveSysInfo * unk, u8 val) { - unk->field_48 = val; + unk->mysteryGiftActive = val; } u32 sub_02023830(struct SaveSysInfo * unk) diff --git a/arm9/src/scrcmd.c b/arm9/src/scrcmd.c index bb9ed05e8..eb98c86c4 100644 --- a/arm9/src/scrcmd.c +++ b/arm9/src/scrcmd.c @@ -14,6 +14,9 @@ #include "main.h" #include "math_util.h" #include "message_format.h" +#include "msgdata.h" +#include "msgdata/msg.naix" +#include "msgdata/msg/narc_0327.h" #include "options.h" #include "party.h" #include "player_data.h" @@ -370,6 +373,27 @@ extern u16 sub_0205F760(SaveVarsFlags *varsFlags); extern Poffin *Poffin_New(HeapID heapId); extern u32 sub_02027F04(Poffin *poffin, u8 *bytes, u8 param2, u32 param3); extern u16 sub_02028094(SavePoffinData *savePoffinData, Poffin *poffin); +extern u16 sub_02028074(SavePoffinData *savePoffinData); +extern u16 sub_0205F4A0(SaveVarsFlags *varsFlags, u8 eventId); +extern void *sub_02037A48(HeapID heapId, FieldSystem *fieldSystem, u16 param2); +extern void ov06_0224F12C(FieldSystem *fieldSystem, u16 *var, u32 param2, HeapID heapId); +extern u16 sub_0205F6A8(SaveVarsFlags *varsFlags); +extern void ov06_02239944(TaskManager *taskManager); +extern void ov06_02239AAC(TaskManager *taskManager); +extern u32 sub_020286EC(SaveData *saveData); +extern u16 sub_02028448(u32 param0); +extern u32 sub_02026CC4(SaveData *saveData); +extern void sub_02025C30(u32 param0); +extern void sub_02033E74(void); +extern void sub_02033ED0(void); +extern void sub_02034E48(FieldSystem *fieldSystem); +extern Location *LocalFieldData_GetSpecialSpawnWarpPtr(LocalFieldData *localFieldData); +extern u16 GetTrainerCardLevel(FieldSystem *fieldSystem); +extern SaveStatsPrinter *Field_SaveStatsPrinter_New(FieldSystem *fieldSystem, HeapID heapId, u32 param2); +extern void Field_SaveStatsPrinter_Print(SaveStatsPrinter *saveStatsPrinter); +extern void Field_SaveStatsPrinter_RemoveFromScreen(SaveStatsPrinter *saveStatsPrinter); +extern void Field_SaveStatsPrinter_Delete(SaveStatsPrinter *saveStatsPrinter); +extern void sub_0206367C(FieldSystem *fieldSystem, u8 value); u8 UNK_021C5A0C[4]; @@ -377,6 +401,8 @@ extern u8 *UNK_020F34E0; extern const u32 UNK_020F34FC[PARTY_SIZE]; extern const u16 UNK_020F3538[18]; +BOOL sub_0203BC04(ScriptContext *ctx); //can't be static, referenced in scrcmd_move_relearner.c + static BOOL RunPauseTimer(ScriptContext *ctx); static u32 Compare(u16 a, u16 b); static BOOL sub_02039CC8(ScriptContext *ctx); @@ -399,7 +425,6 @@ static void sub_0203B1A8(u32 param0, UnkStruct_0203B174 *param1); static BOOL sub_0203B218(ScriptContext *ctx); /*static*/ BOOL sub_0203BB90(ScriptContext *ctx); static BOOL sub_0203BBBC(ScriptContext *ctx); -/*static*/ BOOL sub_0203BC04(ScriptContext *ctx); static BOOL Script_CheckPortraitSlotFull(FieldSystem *fieldSystem, BOOL isContest, u32 portraitSlot); static FashionAppData *sub_0203BC6C(HeapID heapId, FieldSystem *fieldSystem, BOOL isContest, u32 portraitSlot); static BOOL sub_0203BE9C(ScriptContext *ctx); @@ -889,7 +914,7 @@ BOOL ScrCmd_Unk01FE(ScriptContext *ctx) //01FE u16 *unkArr = ctx->fieldSystem->unkA8->unk90[id].unk0; if (unkArr[0] == 0xFFFF) { - MsgData *msgdata = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, 0x22b, HEAP_ID_32); + MsgData *msgdata = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0555_bin, HEAP_ID_32); ov05_021E2BD0(ctx, msgdata, unkArr[1], 1, NULL); DestroyMsgData(msgdata); } @@ -2026,7 +2051,7 @@ BOOL ScrCmd_Unk0195(ScriptContext *ctx) { //0195 } *unk1 = sub_02037A70(*partyMenuData); - *unk1 = (*unk1 == 1); + *unk1 = (*unk1 == TRUE); FreeToHeap(*partyMenuData); *partyMenuData = NULL; @@ -2111,7 +2136,7 @@ static BOOL sub_0203BBBC(ScriptContext *ctx) { return TRUE; } -/*static*/ BOOL sub_0203BC04(ScriptContext *ctx) { +BOOL sub_0203BC04(ScriptContext *ctx) { return !sub_0204647C(ctx->fieldSystem); } @@ -4576,3 +4601,253 @@ BOOL ScrCmd_Unk0289(ScriptContext *ctx) { //0289 } return FALSE; } + +BOOL ScrCmd_Unk028A(ScriptContext *ctx) { //028A + u16 *var = ScriptGetVarPointer(ctx); + if (sub_02028074(Save_PoffinData_Get(ctx->fieldSystem->saveData)) == 0xFFFF) { + *var = 0; + } else { + *var = 1; + } + return FALSE; +} + +BOOL ScrCmd_CheckEventValidity(ScriptContext *ctx) { //028B + u8 eventId = ScriptReadByte(ctx); + u16 *var = ScriptGetVarPointer(ctx); + SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); + GF_ASSERT(eventId <= 3); + *var = sub_0205F4A0(varsFlags, eventId); + return FALSE; +} + +BOOL ScrCmd_Unk028F(ScriptContext *ctx) { //028F + u16 *var = ScriptGetVarPointer(ctx); + s32 loadResult; + HallOfFame *hallOfFame = LoadHallOfFame(ctx->fieldSystem->saveData, HEAP_ID_32, &loadResult); + if (loadResult == 0) { + *var = 0; + FreeToHeap(hallOfFame); + return TRUE; + } else if (loadResult == 1) { + *var = Save_HOF_TranslateRecordIdx(hallOfFame, 0); + FreeToHeap(hallOfFame); + return TRUE; + } else if (loadResult == 2) { + *var = 0; + FreeToHeap(hallOfFame); + return TRUE; + } + *var = 0; + return TRUE; +} + +BOOL ScrCmd_Unk0290(ScriptContext *ctx) { //0290 + u16 unk0 = ScriptGetVar(ctx); + void **runningAppData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); //todo: find out what this is + *runningAppData = sub_02037A48(HEAP_ID_32, ctx->fieldSystem, unk0); + SetupNativeScript(ctx, sub_0203BC04); + return TRUE; +} + +BOOL ScrCmd_Unk0291(ScriptContext *ctx) { //0291 + u16 *var1 = ScriptGetVarPointer(ctx); + u16 *var2 = ScriptGetVarPointer(ctx); + PartyMenuAppData **partyMenu = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); + GF_ASSERT(*partyMenu != NULL); + *var1 = sub_02037A40(*partyMenu); + if (*var1 == 7) { + *var1 = 255; + } + *var2 = sub_02037A70(*partyMenu); + *var2 = (*var2 == TRUE); + FreeToHeap(*partyMenu); + *partyMenu = NULL; + return FALSE; +} + +BOOL ScrCmd_Unk0292(ScriptContext *ctx) { //0292 + u8 limit = ScriptReadByte(ctx); + u16 *var = ScriptGetVarPointer(ctx); + if (limit > 100) { + limit = 100; + } + u16 rnd = LCRandom() % 101; + *var = (rnd <= limit); + return FALSE; +} + +BOOL ScrCmd_Unk029E(ScriptContext *ctx) { //029E + u16 unk0 = ScriptGetVar(ctx); + u16 *var = ScriptGetVarPointer(ctx); + FieldSystem *fieldSystem = ctx->fieldSystem; + switch (unk0) { + case 0: + ov06_0224F12C(fieldSystem, var, 0, HEAP_ID_32); + break; + case 1: + ov06_0224F12C(fieldSystem, var, 1, HEAP_ID_32); + break; + case 2: + ov06_0224F12C(fieldSystem, var, 2, HEAP_ID_32); + break; + default: + GF_ASSERT(FALSE); + break; + } + return TRUE; +} + +BOOL ScrCmd_Unk0293(ScriptContext *ctx) { //0293 + SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_0205F6A8(varsFlags); + return FALSE; +} + +BOOL ScrCmd_ShakeCamera(ScriptContext *ctx) { //029F + u16 type = ScriptGetVar(ctx); + if (type == 0) { + ov06_02239944(ctx->fieldSystem->taskManager); + } else { + ov06_02239AAC(ctx->fieldSystem->taskManager); + } + return TRUE; +} + +BOOL ScrCmd_Unk02A3(ScriptContext *ctx) { //02A3 + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_0203384C(ctx->fieldSystem->saveData); + return FALSE; +} + +BOOL ScrCmd_Unk02A4(ScriptContext *ctx) { //02A4 + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_02028448(sub_020286EC(ctx->fieldSystem->saveData)); + return FALSE; +} + +BOOL ScrCmd_Unk02A2(ScriptContext *ctx) { //02A2 + u16 unk0 = ScriptGetVar(ctx); + u32 res = sub_02026CC4(ctx->fieldSystem->saveData); + u16 unk1 = unk0 + 0xFF79; //this is weird + if (unk1 <= 1) { + sub_02025C30(res); + } + return FALSE; +} + +BOOL ScrCmd_Unk02A7(ScriptContext *ctx) { //02A7 + u16 unk0 = ScriptGetVar(ctx); + u16 *var = ScriptGetVarPointer(ctx); + *var = 0; + if (unk0 >= 0x12A && unk0 <= 0x139) { + *var = 1; + } + return FALSE; +} + +BOOL ScrCmd_CompareMysteryGiftEasyChatInput(ScriptContext *ctx) { //02AA + u16 *var = ScriptGetVarPointer(ctx); + u16 word0 = ScriptGetVar(ctx); + u16 word1 = ScriptGetVar(ctx); + u16 word2 = ScriptGetVar(ctx); + u16 word3 = ScriptGetVar(ctx); + MessageFormat *messageFormat = MessageFormat_New(HEAP_ID_32); + MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_DIRECT, NARC_MSGDATA_MSG, NARC_msg_narc_0327_bin, HEAP_ID_32); + BufferECWord(messageFormat, 0, word0); + BufferECWord(messageFormat, 1, word1); + BufferECWord(messageFormat, 2, word2); + BufferECWord(messageFormat, 3, word3); + String *userInput = ReadMsgData_ExpandPlaceholders(messageFormat, msgData, narc_0327_00001, HEAP_ID_32); + String *targetString = NewString_ReadMsgData(msgData, narc_0327_00000); + *var = String_Compare(userInput, targetString) == FALSE; + String_Delete(userInput); + String_Delete(targetString); + DestroyMsgData(msgData); + MessageFormat_Delete(messageFormat); + return FALSE; +} + +BOOL ScrCmd_ActivateMysteryGift(ScriptContext *ctx) { //02AC + Save_SysInfo_SetMysteryGiftActive(Save_SysInfo_Get(ctx->fieldSystem->saveData), TRUE); + return FALSE; +} + +BOOL ScrCmd_Unk02AF(ScriptContext *ctx) { //02AF + FieldSystem *fieldSystem = ctx->fieldSystem; + u16 *var = ScriptGetVarPointer(ctx); + MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); + *var = sub_0205296C(*messageFormat); + return FALSE; +} + +BOOL ScrCmd_Unk02B0(ScriptContext *ctx) { //02B0 + sub_02033E74(); + return FALSE; +} + +BOOL ScrCmd_Unk02B1(ScriptContext *ctx) { //02B1 + sub_02033ED0(); + return FALSE; +} + +BOOL ScrCmd_Unk02B2(ScriptContext *ctx) { //02B2 + sub_02034E48(ctx->fieldSystem); + return FALSE; +} + +BOOL ScrCmd_Unk02B5(ScriptContext *ctx) { //02B5 + u16 mapId = ScriptGetVar(ctx); + u16 x = ScriptGetVar(ctx); + u16 y = ScriptGetVar(ctx); + Location *specialSpawn = LocalFieldData_GetSpecialSpawnWarpPtr(Save_LocalFieldData_Get(ctx->fieldSystem->saveData)); + specialSpawn->mapId = mapId; + specialSpawn->x = x; + specialSpawn->y = y; + specialSpawn->warpId = -1; + specialSpawn->direction = DIR_SOUTH; + return FALSE; +} + +BOOL ScrCmd_Unk02B6(ScriptContext *ctx) { //02B6 + u16 objectId = ScriptGetVar(ctx); + u8 unk0 = ScriptReadByte(ctx); + LocalMapObject *object = GetMapObjectByID(ctx->fieldSystem->mapObjectManager, objectId); + GF_ASSERT(object != NULL); + sub_020588B8(object, unk0); + return FALSE; +} + +BOOL ScrCmd_GetTrainerCardLevel(ScriptContext *ctx) { //02BE + FieldSystem *fieldSystem = ctx->fieldSystem; + u16 *var = ScriptGetVarPointer(ctx); + *var = GetTrainerCardLevel(fieldSystem); + return FALSE; +} + +BOOL ScrCmd_ShowSaveStats(ScriptContext *ctx) { //02C1 + FieldSystem *fieldSystem = ctx->fieldSystem; + SaveStatsPrinter **saveStatsPrinter = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SAVE_STATS_PRINTER); + if (!Save_FileDoesNotBelongToPlayer(fieldSystem->saveData)) { + *saveStatsPrinter = Field_SaveStatsPrinter_New(fieldSystem, HEAP_ID_4, 3); + Field_SaveStatsPrinter_Print(*saveStatsPrinter); + } + return FALSE; +} + +BOOL ScrCmd_HideSaveStats(ScriptContext *ctx) { //02C2 + FieldSystem *fieldSystem = ctx->fieldSystem; + SaveStatsPrinter **saveStatsPrinter = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SAVE_STATS_PRINTER); + if (!Save_FileDoesNotBelongToPlayer(fieldSystem->saveData)) { + Field_SaveStatsPrinter_RemoveFromScreen(*saveStatsPrinter); + Field_SaveStatsPrinter_Delete(*saveStatsPrinter); + } + return FALSE; +} + +BOOL ScrCmd_ScopeMode(ScriptContext *ctx) { //02C3 + u8 value = ScriptReadByte(ctx); + sub_0206367C(ctx->fieldSystem, value); + return FALSE; +} diff --git a/arm9/src/scrcmd_names.c b/arm9/src/scrcmd_names.c index 5b8a3f9c5..a3648f16d 100644 --- a/arm9/src/scrcmd_names.c +++ b/arm9/src/scrcmd_names.c @@ -2,6 +2,8 @@ #include "event_data.h" #include "itemtool.h" #include "message_format.h" +#include "msgdata.h" +#include "msgdata/msg.naix" #include "nutdata.h" #include "party.h" #include "player_data.h" @@ -234,7 +236,7 @@ BOOL ScrCmd_Unk00DA(ScriptContext *ctx) //00DA - todo: BufferPokemonSpeciesName? static String *sub_02040AE4(u32 msg_no, HeapID heapId) //todo: GetPokemonSpeciesName? { - MsgData *msg_data = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, 362, heapId); //todo change to NAIX + MsgData *msg_data = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0362_bin, heapId); String *ret = NewString_ReadMsgData(msg_data, msg_no); DestroyMsgData(msg_data); diff --git a/arm9/src/trainer_data.c b/arm9/src/trainer_data.c index 3c29ed609..5690dcca3 100644 --- a/arm9/src/trainer_data.c +++ b/arm9/src/trainer_data.c @@ -5,6 +5,7 @@ #include "party.h" #include "proto.h" #include "msgdata.h" +#include "msgdata/msg.naix" #include "constants/trainer_classes.h" #include "unk_02024E64.h" @@ -17,7 +18,7 @@ void EnemyTrainerSet_Init(struct BattleSetupStruct * enemies, struct SaveData * s32 i; struct String * str; - msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, 559, heapId); + msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0559_bin, heapId); rivalName = GetRivalNamePtr(sub_02024EC0(save)); for (i = 0; i < 4; i++) { diff --git a/arm9/src/unk_02021934.c b/arm9/src/unk_02021934.c index 9d1002979..08554a66b 100644 --- a/arm9/src/unk_02021934.c +++ b/arm9/src/unk_02021934.c @@ -154,7 +154,7 @@ s64 String_atoi(struct String * str, BOOL * flag) return ret; } -BOOL StringCompare(struct String * str1, struct String * str2) +BOOL String_Compare(struct String * str1, struct String * str2) { ASSERT_STR16(str1); ASSERT_STR16(str2); diff --git a/arm9/src/unk_02022504.c b/arm9/src/unk_02022504.c index d91556b75..94d5cdc32 100644 --- a/arm9/src/unk_02022504.c +++ b/arm9/src/unk_02022504.c @@ -22,12 +22,12 @@ void *sub_02022528(struct SaveData *save) return SaveArray_Get(save, 32); } -u8 *LoadHallOfFame(struct SaveData *save, HeapID heapId, int *ret_p) +HallOfFame *LoadHallOfFame(struct SaveData *save, HeapID heapId, int *ret_p) { - return ReadSaveFileFromFlash(save, heapId, 0, ret_p); + return (HallOfFame *)ReadSaveFileFromFlash(save, heapId, 0, ret_p); } -s32 SaveHallOfFame(struct SaveData *save, u8 *data) +s32 SaveHallOfFame(struct SaveData *save, HallOfFame *data) { - return WriteSaveFileToFlash(save, 0, data); + return WriteSaveFileToFlash(save, 0, (u8 *)data); } diff --git a/arm9/src/unk_0202A1E0.c b/arm9/src/unk_0202A1E0.c index b0e548c1b..de4fa491a 100644 --- a/arm9/src/unk_0202A1E0.c +++ b/arm9/src/unk_0202A1E0.c @@ -1,6 +1,7 @@ #include "global.h" #include "MI_memory.h" #include "msgdata.h" +#include "msgdata/msg.naix" #include "heap.h" #include "unk_0202A1E0.h" @@ -471,7 +472,7 @@ void sub_0202A798(struct SaveStruct23_Substruct4 *substruct4, struct Unk0202A798 if(substruct4_substruct1->u_C8_0) { - message = NewMsgDataFromNarc(MSGDATA_LOAD_DIRECT, NARC_MSGDATA_MSG, 17, HEAP_ID_FIELD); + message = NewMsgDataFromNarc(MSGDATA_LOAD_DIRECT, NARC_MSGDATA_MSG, NARC_msg_narc_0017_bin, HEAP_ID_FIELD); ReadMsgDataIntoU16Array(message, (u32) (22 + substruct4_substruct1->u_C8_1), unk_substruct->u_8); DestroyMsgData(message); } diff --git a/arm9/src/unk_02064E4C.c b/arm9/src/unk_02064E4C.c index e5e51c289..04827a7fa 100644 --- a/arm9/src/unk_02064E4C.c +++ b/arm9/src/unk_02064E4C.c @@ -1,5 +1,7 @@ #include "global.h" #include "map_header.h" +#include "msgdata.h" +#include "msgdata/msg.naix" #include "unk_02064E4C.h" #include "font.h" @@ -11,7 +13,7 @@ void sub_02064E4C(struct MsgData * msgData, u16 map_sec, struct String * dest) void sub_02064E60(u32 map_no, HeapID heapId, struct String * dest) { - struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, 382, heapId); + struct MsgData * msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0382_bin, heapId); u16 map_sec = MapHeader_GetMapSec(map_no); sub_02064E4C(msgData, map_sec, dest); diff --git a/include/hall_of_fame.h b/include/hall_of_fame.h index ade543d8a..d52a20755 100644 --- a/include/hall_of_fame.h +++ b/include/hall_of_fame.h @@ -4,6 +4,7 @@ #define NUM_HOF_RECORDS 30 #include "RTC_api.h" +#include "pokemon.h" struct HOFMon { diff --git a/include/save_system_info.h b/include/save_system_info.h index 25db223d0..d2d481557 100644 --- a/include/save_system_info.h +++ b/include/save_system_info.h @@ -24,7 +24,7 @@ typedef struct SaveSysInfo /* 0x0E */ u8 birthMonth; /* 0x0F */ u8 birthDay; /* 0x10 */ struct UnkSaveStruct_0202376C_sub rtcInfo; - /* 0x48 */ u8 field_48; + /* 0x48 */ u8 mysteryGiftActive; u8 filler_49[3]; /* 0x4C */ u32 field_4C; u8 padding_50[12]; @@ -39,8 +39,8 @@ BOOL Save_SysInfo_MacAddressIsMine(struct SaveSysInfo * unk); BOOL Save_SysInfo_RTCOffsetIsMine(struct SaveSysInfo * unk); u8 Save_SysInfo_GetBirthMonth(struct SaveSysInfo * unk); u8 Save_SysInfo_GetBirthDay(struct SaveSysInfo * unk); -u8 sub_02023820(struct SaveSysInfo * unk); -void sub_02023828(struct SaveSysInfo * unk, u8 val); +u8 Save_SysInfo_GetMysteryGiftActive(struct SaveSysInfo * unk); +void Save_SysInfo_SetMysteryGiftActive(struct SaveSysInfo * unk, u8 val); u32 sub_02023830(struct SaveSysInfo * unk); void sub_02023834(struct SaveSysInfo * unk, u32 val); void Save_SysInfo_RTC_Init(struct UnkSaveStruct_0202376C_sub * sub); diff --git a/include/scrcmd.h b/include/scrcmd.h index d1d42c4a4..1709471c0 100644 --- a/include/scrcmd.h +++ b/include/scrcmd.h @@ -428,6 +428,31 @@ BOOL ScrCmd_Unk0286(ScriptContext *ctx); BOOL ScrCmd_Unk0287(ScriptContext *ctx); BOOL ScrCmd_Unk0288(ScriptContext *ctx); BOOL ScrCmd_Unk0289(ScriptContext *ctx); +BOOL ScrCmd_Unk028A(ScriptContext *ctx); +BOOL ScrCmd_CheckEventValidity(ScriptContext *ctx); +BOOL ScrCmd_Unk028F(ScriptContext *ctx); +BOOL ScrCmd_Unk0290(ScriptContext *ctx); +BOOL ScrCmd_Unk0291(ScriptContext *ctx); +BOOL ScrCmd_Unk0292(ScriptContext *ctx); +BOOL ScrCmd_Unk029E(ScriptContext *ctx); +BOOL ScrCmd_Unk0293(ScriptContext *ctx); +BOOL ScrCmd_ShakeCamera(ScriptContext *ctx); +BOOL ScrCmd_Unk02A3(ScriptContext *ctx); +BOOL ScrCmd_Unk02A4(ScriptContext *ctx); +BOOL ScrCmd_Unk02A2(ScriptContext *ctx); +BOOL ScrCmd_Unk02A7(ScriptContext *ctx); +BOOL ScrCmd_CompareMysteryGiftEasyChatInput(ScriptContext *ctx); +BOOL ScrCmd_ActivateMysteryGift(ScriptContext *ctx); +BOOL ScrCmd_Unk02AF(ScriptContext *ctx); +BOOL ScrCmd_Unk02B0(ScriptContext *ctx); +BOOL ScrCmd_Unk02B1(ScriptContext *ctx); +BOOL ScrCmd_Unk02B2(ScriptContext *ctx); +BOOL ScrCmd_Unk02B5(ScriptContext *ctx); +BOOL ScrCmd_Unk02B6(ScriptContext *ctx); +BOOL ScrCmd_GetTrainerCardLevel(ScriptContext *ctx); +BOOL ScrCmd_ShowSaveStats(ScriptContext *ctx); +BOOL ScrCmd_HideSaveStats(ScriptContext *ctx); +BOOL ScrCmd_ScopeMode(ScriptContext *ctx); // scrcmd_mart.c BOOL ScrCmd_NormalMart(ScriptContext *ctx); diff --git a/include/script.h b/include/script.h index e2302a4ef..d47e5210b 100644 --- a/include/script.h +++ b/include/script.h @@ -119,6 +119,10 @@ typedef struct SavePoffinData { } SavePoffinData; //todo: fill out and move to own file +typedef struct SaveStatsPrinter { + +} SaveStatsPrinter; //todo: fill out and move to own file + typedef struct FieldSystem //todo move to field_system.c { u32 *unk00; diff --git a/include/string16.h b/include/string16.h index a9876e717..d48f44eac 100644 --- a/include/string16.h +++ b/include/string16.h @@ -16,7 +16,7 @@ typedef struct String #define STR16_MAGIC 0xB6F8D2EC struct String * String_New(u32 count, HeapID heapId); -BOOL StringCompare(struct String *, struct String *); +BOOL String_Compare(struct String *, struct String *); void CopyU16ArrayToStringN(struct String *, u16 *, u32); // copy void StringSetEmpty(struct String *); // set empty struct String * StringDup(struct String *, HeapID heapId); diff --git a/include/unk_02022504.h b/include/unk_02022504.h index 6d5c60f85..1c59bf95c 100644 --- a/include/unk_02022504.h +++ b/include/unk_02022504.h @@ -1,6 +1,7 @@ #ifndef POKEDIAMOND_UNK_02022504_H #define POKEDIAMOND_UNK_02022504_H +#include "hall_of_fame.h" #include "safari_zone.h" #include "save.h" #include "pokemon_storage_system.h" @@ -10,7 +11,7 @@ SafariZone *Save_SafariZone_Get(struct SaveData *save); struct PCStorage *GetStoragePCPointer(struct SaveData *save); struct UnkStruct_0202AC20 * sub_0202251C(struct SaveData *save); void *sub_02022528(struct SaveData *save); -u8 *LoadHallOfFame(struct SaveData *save, HeapID heapId, int *ret_p); -s32 SaveHallOfFame(struct SaveData *save, u8 *data); +HallOfFame *LoadHallOfFame(struct SaveData *save, HeapID heapId, int *ret_p); +s32 SaveHallOfFame(struct SaveData *save, HallOfFame *data); #endif //POKEDIAMOND_UNK_02022504_H