From 58b831b027e56480daa516c352d1e74323d53579 Mon Sep 17 00:00:00 2001 From: red031000 Date: Sun, 27 Jun 2021 22:31:26 +0100 Subject: WM_ks decomp, plus some mod63 docs --- arm9/asm/WM_ks.s | 26 -------------- arm9/lib/include/WM.h | 61 ++++++++++++++++++++++++++++++++ arm9/lib/include/WM_ks.h | 9 +++++ arm9/lib/src/WM_ks.c | 15 ++++++++ arm9/modules/63/include/mod63_021DB450.h | 6 ++-- arm9/modules/63/src/mod63_021DB450.c | 4 +-- 6 files changed, 90 insertions(+), 31 deletions(-) delete mode 100644 arm9/asm/WM_ks.s create mode 100644 arm9/lib/include/WM.h create mode 100644 arm9/lib/include/WM_ks.h create mode 100644 arm9/lib/src/WM_ks.c diff --git a/arm9/asm/WM_ks.s b/arm9/asm/WM_ks.s deleted file mode 100644 index 3dd46c1b..00000000 --- a/arm9/asm/WM_ks.s +++ /dev/null @@ -1,26 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - arm_func_start WM_EndKeySharing -WM_EndKeySharing: ; 0x020DAD3C - ldr ip, _020DAD44 ; =WM_EndDataSharing - bx r12 - .balign 4 -_020DAD44: .word WM_EndDataSharing - - arm_func_start WM_StartKeySharing -WM_StartKeySharing: ; 0x020DAD48 - stmdb sp!, {lr} - sub sp, sp, #0x4 - ldr r2, _020DAD70 ; =0x0000FFFF - mov r12, #0x1 - mov r3, #0x2 - str r12, [sp, #0x0] - bl WM_StartDataSharing - add sp, sp, #0x4 - ldmia sp!, {lr} - bx lr - .balign 4 -_020DAD70: .word 0x0000FFFF diff --git a/arm9/lib/include/WM.h b/arm9/lib/include/WM.h new file mode 100644 index 00000000..ad287292 --- /dev/null +++ b/arm9/lib/include/WM.h @@ -0,0 +1,61 @@ +#ifndef POKEDIAMOND_WM_H +#define POKEDIAMOND_WM_H + +#include "nitro/types.h" + +typedef struct WMDataSet +{ + u16 aidBitmap; + u16 receivedBitmap; + u16 data[508 / sizeof(u16)]; +} WMDataSet; + +typedef struct WMDataSharingInfo +{ + WMDataSet ds[4]; + u16 seqNum[4]; + u16 writeIndex; + u16 sendIndex; + u16 readIndex; + u16 aidBitmap; + u16 dataLength; + u16 stationNumber; + u16 dataSetLength; + u16 port; + u16 doubleMode; + u16 currentSeqNum; + u16 state; + u16 reserved[1]; +} WMDataSharingInfo; + +typedef WMDataSharingInfo WMKeySetBuf; + +typedef enum WMErrCode +{ + WM_ERRCODE_SUCCESS = 0, + WM_ERRCODE_FAILED = 1, + WM_ERRCODE_OPERATING = 2, + WM_ERRCODE_ILLEGAL_STATE = 3, + WM_ERRCODE_WM_DISABLE = 4, + WM_ERRCODE_NO_KEYSET = 5, + WM_ERRCODE_NO_DATASET = 5, + WM_ERRCODE_INVALID_PARAM = 6, + WM_ERRCODE_NO_CHILD = 7, + WM_ERRCODE_FIFO_ERROR = 8, + WM_ERRCODE_TIMEOUT = 9, + WM_ERRCODE_SEND_QUEUE_FULL = 10, + WM_ERRCODE_NO_ENTRY = 11, + WM_ERRCODE_OVER_MAX_ENTRY = 12, + WM_ERRCODE_INVALID_POLLBITMAP = 13, + WM_ERRCODE_NO_DATA = 14, + WM_ERRCODE_SEND_FAILED = 15, + + WM_ERRCODE_DCF_TEST, + WM_ERRCODE_WL_INVALID_PARAM, + WM_ERRCODE_WL_LENGTH_ERR, + + WM_ERRCODE_FLASH_ERROR, + WM_ERRCODE_MAX +} WMErrCode; + +#endif //POKEDIAMOND_WM_H diff --git a/arm9/lib/include/WM_ks.h b/arm9/lib/include/WM_ks.h new file mode 100644 index 00000000..0eeb6b1b --- /dev/null +++ b/arm9/lib/include/WM_ks.h @@ -0,0 +1,9 @@ +#ifndef POKEDIAMOND_WM_KS_H +#define POKEDIAMOND_WM_KS_H + +#include "WM.h" + +WMErrCode WM_StartKeySharing(WMKeySetBuf *buf, u16 port); +WMErrCode WM_EndKeySharing(WMKeySetBuf *buf); + +#endif //POKEDIAMOND_WM_KS_H diff --git a/arm9/lib/src/WM_ks.c b/arm9/lib/src/WM_ks.c new file mode 100644 index 00000000..93e96f89 --- /dev/null +++ b/arm9/lib/src/WM_ks.c @@ -0,0 +1,15 @@ +#include "WM_ks.h" +#include "function_target.h" + +extern WMErrCode WM_StartDataSharing(WMKeySetBuf *buf, u16 port, u16 aidBitmap, u16 dataLength, BOOL doubleMode); +extern WMErrCode WM_EndDataSharing(WMKeySetBuf *buf); + +ARM_FUNC WMErrCode WM_StartKeySharing(WMKeySetBuf *buf, u16 port) +{ + return WM_StartDataSharing(buf, port, 0xffff, 2, TRUE); +} + +ARM_FUNC WMErrCode WM_EndKeySharing(WMKeySetBuf *buf) +{ + return WM_EndDataSharing(buf); +} diff --git a/arm9/modules/63/include/mod63_021DB450.h b/arm9/modules/63/include/mod63_021DB450.h index e5ecc7df..ac3da1b6 100644 --- a/arm9/modules/63/include/mod63_021DB450.h +++ b/arm9/modules/63/include/mod63_021DB450.h @@ -3,10 +3,10 @@ #include "global.h" -typedef struct UnkStruct63_021DB450 +typedef struct UnkStruct63_021DB450 //intro base struct type { - struct UnkStruct63_021DB450 * field_00; - u32 field_04[3]; + struct UnkStruct63_021DB450 * field_00; //oddly requires this to be set to progress past copyright/pokemon screen. + u32 field_04[3]; //mon animations? u32 field_10; void * field_14; void * field_18; diff --git a/arm9/modules/63/src/mod63_021DB450.c b/arm9/modules/63/src/mod63_021DB450.c index 84461fe1..454b2b19 100644 --- a/arm9/modules/63/src/mod63_021DB450.c +++ b/arm9/modules/63/src/mod63_021DB450.c @@ -69,12 +69,12 @@ THUMB_FUNC u32 MOD63_021DB498(void) return 32; } -THUMB_FUNC void Title_SetupMonAnimationSprites(struct UnkStruct63_021DB450 * arg0) +THUMB_FUNC void Title_SetupMonAnimationSprites(struct UnkStruct63_021DB450 * arg0) //TODO: this does a lot more than setup anim sprites { struct UnkStruct63_021DB49C sp1C; int introMonArray[3] = {SPECIES_TURTWIG, SPECIES_CHIMCHAR, SPECIES_PIPLUP}; - arg0->field_00 = FUN_02006D98(76); + arg0->field_00 = FUN_02006D98(76); //this is needed to get into the world view, otherwise it is just black for (u8 i = 0; i < 3; i++) //some kind of animation assignment TODO: investigate further { -- cgit v1.2.3 From 17f024a5179351f68eba823f61f02f2c2f934112 Mon Sep 17 00:00:00 2001 From: SNBeast Date: Sun, 27 Jun 2021 19:03:01 -0400 Subject: Decompile unk_02088DD8.s --- arm9/asm/unk_02088DD8.s | 172 ----------------------------------- arm9/global.inc | 2 +- arm9/src/scrcmd_24.c | 8 +- arm9/src/unk_02088DD8.c | 76 ++++++++++++++++ files/graphic/poketch/narc_0010.NCGR | Bin 0 -> 2112 bytes include/unk_02088DD8.h | 9 ++ 6 files changed, 88 insertions(+), 179 deletions(-) delete mode 100644 arm9/asm/unk_02088DD8.s create mode 100644 arm9/src/unk_02088DD8.c create mode 100644 files/graphic/poketch/narc_0010.NCGR diff --git a/arm9/asm/unk_02088DD8.s b/arm9/asm/unk_02088DD8.s deleted file mode 100644 index 3df58ffe..00000000 --- a/arm9/asm/unk_02088DD8.s +++ /dev/null @@ -1,172 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start FUN_02088DD8 -FUN_02088DD8: ; 0x02088DD8 - push {r3, lr} - mov r1, #0x18 - bl AllocFromHeap - add r3, r0, #0x0 - mov r2, #0x18 - mov r1, #0x0 -_02088DE6: - strb r1, [r3, #0x0] - add r3, r3, #0x1 - sub r2, r2, #0x1 - bne _02088DE6 - pop {r3, pc} - - thumb_func_start FUN_02088DF0 -FUN_02088DF0: ; 0x02088DF0 - ldr r3, _02088DF4 ; =FreeToHeap - bx r3 - .balign 4 -_02088DF4: .word FreeToHeap - - thumb_func_start FUN_02088DF8 -FUN_02088DF8: ; 0x02088DF8 - push {r3-r7, lr} - sub sp, #0x18 - str r1, [sp, #0x0] - mov r1, #0x5 - mov r2, #0x0 - add r5, r0, #0x0 - bl GetMonData - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - str r0, [sp, #0xc] - add r0, r5, #0x0 - mov r1, #0x70 - mov r2, #0x0 - bl GetMonData - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - str r0, [sp, #0x8] - add r0, r5, #0x0 - mov r1, #0xa0 - mov r2, #0x0 - bl GetMonData - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - mov r4, #0x0 - str r0, [sp, #0x4] - add r7, r4, #0x0 - add r6, sp, #0x10 -_02088E34: - add r1, r4, #0x0 - add r0, r5, #0x0 - add r1, #0x36 - add r2, r7, #0x0 - bl GetMonData - lsl r1, r4, #0x1 - strh r0, [r6, r1] - add r0, r4, #0x1 - lsl r0, r0, #0x18 - lsr r4, r0, #0x18 - cmp r4, #0x4 - blo _02088E34 - ldr r0, [sp, #0x0] - mov r1, #0x2c - bl AllocFromHeap - add r7, r0, #0x0 - ldr r0, [sp, #0x0] - mov r1, #0x2c - bl AllocFromHeap - add r4, r0, #0x0 - ldr r0, [sp, #0xc] - ldr r1, [sp, #0x8] - add r2, r7, #0x0 - bl LoadWotbl_HandleAlternateForme - mov r2, #0x0 - mov r12, r2 -_02088E70: - mov r0, r12 - lsl r0, r0, #0x1 - ldrh r5, [r7, r0] - ldr r6, _02088EF4 ; =0x0000FFFF - cmp r5, r6 - bne _02088E82 - lsl r0, r2, #0x1 - strh r6, [r4, r0] - b _02088EE8 -_02088E82: - mov r1, #0xfe - lsl r1, r1, #0x8 - and r1, r5 - asr r3, r1, #0x9 - ldr r1, [sp, #0x4] - cmp r3, r1 - bgt _02088EDA - lsr r1, r6, #0x7 - and r1, r5 - strh r1, [r7, r0] - ldrh r3, [r7, r0] - mov r1, #0x0 - add r6, sp, #0x10 -_02088E9C: - lsl r5, r1, #0x1 - ldrh r5, [r6, r5] - cmp r3, r5 - beq _02088EAE - add r1, r1, #0x1 - lsl r1, r1, #0x18 - lsr r1, r1, #0x18 - cmp r1, #0x4 - blo _02088E9C -_02088EAE: - cmp r1, #0x4 - bne _02088EDA - mov r1, #0x0 - cmp r2, #0x0 - bls _02088ECA -_02088EB8: - lsl r5, r1, #0x1 - ldrh r5, [r4, r5] - cmp r5, r3 - beq _02088ECA - add r1, r1, #0x1 - lsl r1, r1, #0x18 - lsr r1, r1, #0x18 - cmp r1, r2 - blo _02088EB8 -_02088ECA: - cmp r1, r2 - bne _02088EDA - ldrh r1, [r7, r0] - lsl r0, r2, #0x1 - strh r1, [r4, r0] - add r0, r2, #0x1 - lsl r0, r0, #0x18 - lsr r2, r0, #0x18 -_02088EDA: - mov r0, r12 - add r0, r0, #0x1 - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - mov r12, r0 - cmp r0, #0x16 - blo _02088E70 -_02088EE8: - add r0, r7, #0x0 - bl FreeToHeap - add r0, r4, #0x0 - add sp, #0x18 - pop {r3-r7, pc} - .balign 4 -_02088EF4: .word 0x0000FFFF - - thumb_func_start FUN_02088EF8 -FUN_02088EF8: ; 0x02088EF8 - ldrh r1, [r0, #0x0] - ldr r0, _02088F08 ; =0x0000FFFF - cmp r1, r0 - beq _02088F04 - mov r0, #0x1 - bx lr -_02088F04: - mov r0, #0x0 - bx lr - .balign 4 -_02088F08: .word 0x0000FFFF diff --git a/arm9/global.inc b/arm9/global.inc index 086d9b5f..e1952cc2 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -5450,7 +5450,7 @@ .extern FUN_02088DBC .extern FUN_02088DD8 .extern FUN_02088DF0 -.extern FUN_02088DF8 +.extern Maybe_GetEligibleLevelUpMoves .extern FUN_02088EF8 .extern FUN_02088F0C .extern FUN_02088F4C diff --git a/arm9/src/scrcmd_24.c b/arm9/src/scrcmd_24.c index b38ed05a..f4330150 100644 --- a/arm9/src/scrcmd_24.c +++ b/arm9/src/scrcmd_24.c @@ -10,10 +10,6 @@ extern struct UnkStruct_02037CF0* FUN_02037CF0(u32 heap_id, struct UnkSavStruct8 extern u8 FUN_02037D5C(struct UnkStruct_02037CF0*); extern void FUN_02038864(struct UnkSavStruct80*, struct UnkStruct_02088DD8*); extern BOOL FUN_0203BC04(struct ScriptContext* ctx); -extern struct UnkStruct_02088DD8* FUN_02088DD8(u32 heap_id); -extern void FUN_02088DF0(struct UnkStruct_02037CF0*); -extern void* FUN_02088DF8(struct Pokemon* pokemon, u32 heap_id); -extern BOOL FUN_02088EF8(void*); THUMB_FUNC BOOL ScrCmd_Unk01C6(struct ScriptContext* ctx) { @@ -57,7 +53,7 @@ THUMB_FUNC BOOL ScrCmd_Unk021F(struct ScriptContext* ctx) u16 mon_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); struct PlayerParty* party = SavArray_PlayerParty_get(ctx->unk80->saveBlock2); struct Pokemon* pokemon = GetPartyMonByIndex(party, mon_idx); - void* unk_ptr = FUN_02088DF8(pokemon, 32); + void* unk_ptr = Maybe_GetEligibleLevelUpMoves(pokemon, 32); *ret_ptr = (u16)FUN_02088EF8(unk_ptr); FreeToHeap(unk_ptr); @@ -96,7 +92,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0221(struct ScriptContext* ctx) u16 mon_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); struct PlayerParty* party = SavArray_PlayerParty_get(ctx->unk80->saveBlock2); struct Pokemon* pokemon = GetPartyMonByIndex(party, mon_idx); - void* unk_ptr = FUN_02088DF8(pokemon, 32); + void* unk_ptr = Maybe_GetEligibleLevelUpMoves(pokemon, 32); FUN_02045E74(ctx, 1, pokemon, unk_ptr); return TRUE; diff --git a/arm9/src/unk_02088DD8.c b/arm9/src/unk_02088DD8.c new file mode 100644 index 00000000..acc59701 --- /dev/null +++ b/arm9/src/unk_02088DD8.c @@ -0,0 +1,76 @@ +#include "global.h" +#include "heap.h" +#include "pokemon.h" +#include "unk_02088DD8.h" + +THUMB_FUNC struct UnkStruct_02088DD8* FUN_02088DD8(u32 r0) { + struct UnkStruct_02088DD8 *returnPointer = AllocFromHeap(r0, 24); + __builtin__clear(returnPointer, 24); + return returnPointer; +} + +THUMB_FUNC void FUN_02088DF0(struct UnkStruct_02037CF0 *r0) { + FreeToHeap(r0); +} + +#define WOTBL_END 0xFFFF +#define WOTBL_MOVE_MASK 0x01FF +#define WOTBL_MOVE_SHIFT 0 +#define WOTBL_LVL_MASK 0xFE00 +#define WOTBL_LVL_SHIFT 9 +#define WOTBL_MOVE(x) ((u16)(((x) & WOTBL_MOVE_MASK) >> WOTBL_MOVE_SHIFT)) +#define WOTBL_LVL(x) (/*(u8)*/(((x) & WOTBL_LVL_MASK) >> WOTBL_LVL_SHIFT)) +// i don't know why either. + +THUMB_FUNC void* Maybe_GetEligibleLevelUpMoves(struct Pokemon* pokemon, u32 heap_id) { + u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, 0); + u8 forme = (u8)GetMonData(pokemon, MON_DATA_FORME, 0); + u8 level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, 0); + u16 moves[4]; + + for (u8 i = 0; i < 4; ++i) { + moves[i] = (u16)GetMonData(pokemon, MON_DATA_MOVE1 + i, 0); + } + + u16 *tableFromFile = AllocFromHeap(heap_id, 44); + u16 *returnTable = AllocFromHeap(heap_id, 44); + + LoadWotbl_HandleAlternateForme(species, forme, tableFromFile); + + for (u8 i = 0, j, k = 0; i < 22; i++) { + if (tableFromFile[i] == WOTBL_END) { + returnTable[k] = WOTBL_END; + break; + } + else { + if (WOTBL_LVL(tableFromFile[i]) > level) continue; + + tableFromFile[i] = WOTBL_MOVE(tableFromFile[i]); + + j = 0; + for (; j < 4; j++) { + if (tableFromFile[i] == moves[j]) break; + } + if (j != 4) continue; + + j = 0; + if (k >= 0) { + // don't know when that would be false + for (; j < k; j++) { + if (returnTable[j] == tableFromFile[i]) break; + } + } + if (j != k) continue; + + returnTable[k] = tableFromFile[i]; + k++; + } + } + + FreeToHeap(tableFromFile); + return returnTable; +} + +THUMB_FUNC BOOL FUN_02088EF8(u16 *r0) { + return *r0 != 0xFFFF; +} \ No newline at end of file diff --git a/files/graphic/poketch/narc_0010.NCGR b/files/graphic/poketch/narc_0010.NCGR new file mode 100644 index 00000000..9dcdc01b Binary files /dev/null and b/files/graphic/poketch/narc_0010.NCGR differ diff --git a/include/unk_02088DD8.h b/include/unk_02088DD8.h index 318a98fb..41e7232e 100644 --- a/include/unk_02088DD8.h +++ b/include/unk_02088DD8.h @@ -1,6 +1,10 @@ #ifndef POKEDIAMOND_UNK_02088DD8_H #define POKEDIAMOND_UNK_02088DD8_H +#include "unk_020377F0.h" + +extern void LoadWotbl_HandleAlternateForme(int species, int forme, u16 * wotbl); + struct Options; struct PlayerData; struct Pokemon; @@ -16,4 +20,9 @@ struct UnkStruct_02088DD8 u8 padding2[0x2]; }; +struct UnkStruct_02088DD8* FUN_02088DD8(u32 r0); +void FUN_02088DF0(struct UnkStruct_02037CF0 *r0); +void* Maybe_GetEligibleLevelUpMoves(struct Pokemon* pokemon, u32 heap_id); +BOOL FUN_02088EF8(u16 *r0); + #endif -- cgit v1.2.3 From 93c3498a65ff4e47367a5d98bd9c6f8fe1f33f89 Mon Sep 17 00:00:00 2001 From: SNBeast Date: Sun, 27 Jun 2021 19:16:57 -0400 Subject: Not maybe, if I am wrong let me be corrected --- arm9/global.inc | 2 +- arm9/src/scrcmd_24.c | 4 ++-- arm9/src/unk_02088DD8.c | 2 +- include/unk_02088DD8.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arm9/global.inc b/arm9/global.inc index e1952cc2..590bf428 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -5450,7 +5450,7 @@ .extern FUN_02088DBC .extern FUN_02088DD8 .extern FUN_02088DF0 -.extern Maybe_GetEligibleLevelUpMoves +.extern GetEligibleLevelUpMoves .extern FUN_02088EF8 .extern FUN_02088F0C .extern FUN_02088F4C diff --git a/arm9/src/scrcmd_24.c b/arm9/src/scrcmd_24.c index f4330150..bfa737be 100644 --- a/arm9/src/scrcmd_24.c +++ b/arm9/src/scrcmd_24.c @@ -53,7 +53,7 @@ THUMB_FUNC BOOL ScrCmd_Unk021F(struct ScriptContext* ctx) u16 mon_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); struct PlayerParty* party = SavArray_PlayerParty_get(ctx->unk80->saveBlock2); struct Pokemon* pokemon = GetPartyMonByIndex(party, mon_idx); - void* unk_ptr = Maybe_GetEligibleLevelUpMoves(pokemon, 32); + void* unk_ptr = GetEligibleLevelUpMoves(pokemon, 32); *ret_ptr = (u16)FUN_02088EF8(unk_ptr); FreeToHeap(unk_ptr); @@ -92,7 +92,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0221(struct ScriptContext* ctx) u16 mon_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); struct PlayerParty* party = SavArray_PlayerParty_get(ctx->unk80->saveBlock2); struct Pokemon* pokemon = GetPartyMonByIndex(party, mon_idx); - void* unk_ptr = Maybe_GetEligibleLevelUpMoves(pokemon, 32); + void* unk_ptr = GetEligibleLevelUpMoves(pokemon, 32); FUN_02045E74(ctx, 1, pokemon, unk_ptr); return TRUE; diff --git a/arm9/src/unk_02088DD8.c b/arm9/src/unk_02088DD8.c index acc59701..d0a08f20 100644 --- a/arm9/src/unk_02088DD8.c +++ b/arm9/src/unk_02088DD8.c @@ -22,7 +22,7 @@ THUMB_FUNC void FUN_02088DF0(struct UnkStruct_02037CF0 *r0) { #define WOTBL_LVL(x) (/*(u8)*/(((x) & WOTBL_LVL_MASK) >> WOTBL_LVL_SHIFT)) // i don't know why either. -THUMB_FUNC void* Maybe_GetEligibleLevelUpMoves(struct Pokemon* pokemon, u32 heap_id) { +THUMB_FUNC void* GetEligibleLevelUpMoves(struct Pokemon* pokemon, u32 heap_id) { u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, 0); u8 forme = (u8)GetMonData(pokemon, MON_DATA_FORME, 0); u8 level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, 0); diff --git a/include/unk_02088DD8.h b/include/unk_02088DD8.h index 41e7232e..78ff4827 100644 --- a/include/unk_02088DD8.h +++ b/include/unk_02088DD8.h @@ -22,7 +22,7 @@ struct UnkStruct_02088DD8 struct UnkStruct_02088DD8* FUN_02088DD8(u32 r0); void FUN_02088DF0(struct UnkStruct_02037CF0 *r0); -void* Maybe_GetEligibleLevelUpMoves(struct Pokemon* pokemon, u32 heap_id); +void* GetEligibleLevelUpMoves(struct Pokemon* pokemon, u32 heap_id); BOOL FUN_02088EF8(u16 *r0); #endif -- cgit v1.2.3 From e22de9da55977f1dce79c7fcebd4a8a60f272b5b Mon Sep 17 00:00:00 2001 From: SNBeast Date: Sun, 27 Jun 2021 22:55:50 -0400 Subject: Minor naming tweak and sizeof As suggested by review --- arm9/src/unk_02088DD8.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arm9/src/unk_02088DD8.c b/arm9/src/unk_02088DD8.c index d0a08f20..572d274f 100644 --- a/arm9/src/unk_02088DD8.c +++ b/arm9/src/unk_02088DD8.c @@ -3,9 +3,9 @@ #include "pokemon.h" #include "unk_02088DD8.h" -THUMB_FUNC struct UnkStruct_02088DD8* FUN_02088DD8(u32 r0) { - struct UnkStruct_02088DD8 *returnPointer = AllocFromHeap(r0, 24); - __builtin__clear(returnPointer, 24); +THUMB_FUNC struct UnkStruct_02088DD8* FUN_02088DD8(u32 heap_id) { + struct UnkStruct_02088DD8 *returnPointer = AllocFromHeap(heap_id, sizeof(struct UnkStruct_02088DD8)); + __builtin__clear(returnPointer, sizeof(struct UnkStruct_02088DD8)); return returnPointer; } -- cgit v1.2.3 From 029dab952d33320442fe2a46879b32175c536a79 Mon Sep 17 00:00:00 2001 From: SNBeast Date: Mon, 28 Jun 2021 23:18:38 -0400 Subject: Another code review's suggestions --- arm9/src/unk_02088DD8.c | 12 ++++++------ files/graphic/poketch/narc_0010.NCGR | Bin 2112 -> 0 bytes include/unk_02088DD8.h | 6 ++---- 3 files changed, 8 insertions(+), 10 deletions(-) delete mode 100644 files/graphic/poketch/narc_0010.NCGR diff --git a/arm9/src/unk_02088DD8.c b/arm9/src/unk_02088DD8.c index 572d274f..b4633d25 100644 --- a/arm9/src/unk_02088DD8.c +++ b/arm9/src/unk_02088DD8.c @@ -3,6 +3,8 @@ #include "pokemon.h" #include "unk_02088DD8.h" +extern void LoadWotbl_HandleAlternateForme(int species, int forme, u16 * wotbl); + THUMB_FUNC struct UnkStruct_02088DD8* FUN_02088DD8(u32 heap_id) { struct UnkStruct_02088DD8 *returnPointer = AllocFromHeap(heap_id, sizeof(struct UnkStruct_02088DD8)); __builtin__clear(returnPointer, sizeof(struct UnkStruct_02088DD8)); @@ -22,7 +24,7 @@ THUMB_FUNC void FUN_02088DF0(struct UnkStruct_02037CF0 *r0) { #define WOTBL_LVL(x) (/*(u8)*/(((x) & WOTBL_LVL_MASK) >> WOTBL_LVL_SHIFT)) // i don't know why either. -THUMB_FUNC void* GetEligibleLevelUpMoves(struct Pokemon* pokemon, u32 heap_id) { +THUMB_FUNC u16* GetEligibleLevelUpMoves(struct Pokemon* pokemon, u32 heap_id) { u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, 0); u8 forme = (u8)GetMonData(pokemon, MON_DATA_FORME, 0); u8 level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, 0); @@ -47,16 +49,14 @@ THUMB_FUNC void* GetEligibleLevelUpMoves(struct Pokemon* pokemon, u32 heap_id) { tableFromFile[i] = WOTBL_MOVE(tableFromFile[i]); - j = 0; - for (; j < 4; j++) { + for (j = 0; j < 4; j++) { if (tableFromFile[i] == moves[j]) break; } if (j != 4) continue; - j = 0; if (k >= 0) { // don't know when that would be false - for (; j < k; j++) { + for (j = 0; j < k; j++) { if (returnTable[j] == tableFromFile[i]) break; } } @@ -73,4 +73,4 @@ THUMB_FUNC void* GetEligibleLevelUpMoves(struct Pokemon* pokemon, u32 heap_id) { THUMB_FUNC BOOL FUN_02088EF8(u16 *r0) { return *r0 != 0xFFFF; -} \ No newline at end of file +} diff --git a/files/graphic/poketch/narc_0010.NCGR b/files/graphic/poketch/narc_0010.NCGR deleted file mode 100644 index 9dcdc01b..00000000 Binary files a/files/graphic/poketch/narc_0010.NCGR and /dev/null differ diff --git a/include/unk_02088DD8.h b/include/unk_02088DD8.h index 78ff4827..7b023c56 100644 --- a/include/unk_02088DD8.h +++ b/include/unk_02088DD8.h @@ -3,8 +3,6 @@ #include "unk_020377F0.h" -extern void LoadWotbl_HandleAlternateForme(int species, int forme, u16 * wotbl); - struct Options; struct PlayerData; struct Pokemon; @@ -20,9 +18,9 @@ struct UnkStruct_02088DD8 u8 padding2[0x2]; }; -struct UnkStruct_02088DD8* FUN_02088DD8(u32 r0); +struct UnkStruct_02088DD8* FUN_02088DD8(u32 heap_id); void FUN_02088DF0(struct UnkStruct_02037CF0 *r0); -void* GetEligibleLevelUpMoves(struct Pokemon* pokemon, u32 heap_id); +u16* GetEligibleLevelUpMoves(struct Pokemon* pokemon, u32 heap_id); BOOL FUN_02088EF8(u16 *r0); #endif -- cgit v1.2.3 From 837cd799f76c81e762113bb46dd50176ac614dde Mon Sep 17 00:00:00 2001 From: tgsm Date: Tue, 29 Jun 2021 02:46:32 -0500 Subject: Decompile unk_02034188 --- arm9/asm/unk_02034188.s | 242 ------------------------------------------------ arm9/global.inc | 2 +- arm9/src/main.c | 4 +- arm9/src/unk_02034188.c | 151 ++++++++++++++++++++++++++++++ include/unk_02034188.h | 6 ++ 5 files changed, 160 insertions(+), 245 deletions(-) delete mode 100644 arm9/asm/unk_02034188.s create mode 100644 arm9/src/unk_02034188.c create mode 100644 include/unk_02034188.h diff --git a/arm9/asm/unk_02034188.s b/arm9/asm/unk_02034188.s deleted file mode 100644 index 66bb542c..00000000 --- a/arm9/asm/unk_02034188.s +++ /dev/null @@ -1,242 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .extern gMain - - .section .rodata - - .global UNK_020EECF8 -UNK_020EECF8: ; 0x020EECF8 - .byte 0x00, 0x03, 0x03, 0x1A, 0x12, 0x01, 0x23, 0x00 - - .global UNK_020EED00 -UNK_020EED00: ; 0x020EED00 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .global UNK_020EED10 -UNK_020EED10: ; 0x020EED10 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .global UNK_020EED2C -UNK_020EED2C: ; 0x020EED2C - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .text - - thumb_func_start FUN_02034188 -FUN_02034188: ; 0x02034188 - push {r4-r7, lr} - sub sp, #0x24 - add r4, r0, #0x0 - mov r0, #0x0 - add r1, r0, #0x0 - bl FUN_0200E3A0 - mov r0, #0x1 - mov r1, #0x0 - bl FUN_0200E3A0 - bl FUN_02015EF4 - mov r0, #0x0 - add r1, r0, #0x0 - bl Main_SetVBlankIntrCB - mov r0, #0x0 - add r1, r0, #0x0 - bl FUN_02015F34 - bl GX_DisableEngineALayers - bl GX_DisableEngineBLayers - mov r2, #0x1 - lsl r2, r2, #0x1a - ldr r1, [r2, #0x0] - ldr r0, _02034368 ; =0xFFFFE0FF - and r1, r0 - str r1, [r2, #0x0] - ldr r2, _0203436C ; =0x04001000 - ldr r1, [r2, #0x0] - and r0, r1 - str r0, [r2, #0x0] - mov r0, #0x4 - mov r1, #0x8 - bl SetKeyRepeatTimers - ldr r0, _02034370 ; =gMain + 0x60 - mov r1, #0x0 - strb r1, [r0, #0x5] - bl GX_SwapDisplay - ldr r3, _02034374 ; =0x04000050 - mov r0, #0x0 - strh r0, [r3, #0x0] - ldr r2, _02034378 ; =0x04001050 - sub r3, #0x50 - strh r0, [r2, #0x0] - ldr r1, [r3, #0x0] - ldr r0, _0203437C ; =0xFFFF1FFF - sub r2, #0x50 - and r1, r0 - str r1, [r3, #0x0] - ldr r1, [r2, #0x0] - and r0, r1 - str r0, [r2, #0x0] - ldr r0, _02034380 ; =UNK_020EED2C - bl GX_SetBanks - add r0, r4, #0x0 - bl BgConfig_Alloc - str r0, [sp, #0x10] - ldr r0, _02034384 ; =UNK_020EED00 - bl SetBothScreensModesAndDisable - mov r1, #0x0 - ldr r0, [sp, #0x10] - ldr r2, _02034388 ; =UNK_020EED10 - add r3, r1, #0x0 - bl InitBgFromTemplate - ldr r0, [sp, #0x10] - mov r1, #0x0 - bl BgClearTilemapBufferAndCommit - mov r1, #0x0 - str r1, [sp, #0x0] - ldr r0, [sp, #0x10] - ldr r2, _0203438C ; =0x000001F7 - mov r3, #0x2 - str r4, [sp, #0x4] - bl FUN_0200CB00 - mov r0, #0x0 - mov r1, #0x20 - add r2, r4, #0x0 - bl FUN_02002ED0 - mov r0, #0x0 - mov r1, #0x20 - add r2, r0, #0x0 - add r3, r4, #0x0 - bl BG_ClearCharDataRange - ldr r1, _02034390 ; =0x00006C21 - mov r0, #0x0 - bl BG_SetMaskColor - ldr r1, _02034390 ; =0x00006C21 - mov r0, #0x4 - bl BG_SetMaskColor - ldr r2, _02034394 ; =0x00000265 - mov r0, #0x1 - mov r1, #0x1a - add r3, r4, #0x0 - bl NewMsgDataFromNarc - str r0, [sp, #0xc] - mov r0, #0x6 - lsl r0, r0, #0x6 - add r1, r4, #0x0 - bl String_ctor - add r4, r0, #0x0 - bl FUN_0201BD5C - ldr r0, [sp, #0x10] - ldr r2, _02034398 ; =UNK_020EECF8 - add r1, sp, #0x14 - bl AddWindow - mov r0, #0xd0 - str r0, [sp, #0x0] - mov r0, #0x90 - mov r2, #0x0 - str r0, [sp, #0x4] - add r0, sp, #0x14 - mov r1, #0xf - add r3, r2, #0x0 - bl FillWindowPixelRect - ldr r2, _0203438C ; =0x000001F7 - add r0, sp, #0x14 - mov r1, #0x0 - mov r3, #0x2 - bl FUN_0200CCA4 - ldr r0, [sp, #0xc] - mov r1, #0xf - add r2, r4, #0x0 - bl ReadMsgDataIntoString - mov r1, #0x0 - str r1, [sp, #0x0] - str r1, [sp, #0x4] - add r0, sp, #0x14 - add r2, r4, #0x0 - add r3, r1, #0x0 - str r1, [sp, #0x8] - bl AddTextPrinterParameterized - add r0, r4, #0x0 - bl String_dtor - bl GX_BothDispOn - mov r0, #0x0 - bl FUN_0200E394 - mov r0, #0x1 - bl FUN_0200E394 - mov r0, #0x0 - mov r1, #0x3f - mov r2, #0x3 - bl FUN_0200A274 - ldr r4, _0203439C ; =0x04000130 - ldr r6, _020343A0 ; =0x027FFFA8 - mov r7, #0x1 -_020342E4: - ldrh r1, [r4, #0x0] - ldrh r0, [r6, #0x0] - orr r1, r0 - ldr r0, _020343A4 ; =0x00002FFF - eor r1, r0 - and r0, r1 - lsl r0, r0, #0x10 - lsr r5, r0, #0x10 - bl HandleDSLidAction - add r0, r5, #0x0 - tst r0, r7 - bne _02034308 - mov r0, #0x1 - add r1, r0, #0x0 - bl OS_WaitIrq - b _020342E4 -_02034308: - add r0, sp, #0x14 - bl RemoveWindow - ldr r0, [sp, #0xc] - bl DestroyMsgData - mov r0, #0x0 - add r1, r0, #0x0 - bl ToggleBgLayer - mov r0, #0x1 - mov r1, #0x0 - bl ToggleBgLayer - mov r0, #0x2 - mov r1, #0x0 - bl ToggleBgLayer - mov r0, #0x3 - mov r1, #0x0 - bl ToggleBgLayer - mov r0, #0x4 - mov r1, #0x0 - bl ToggleBgLayer - mov r0, #0x5 - mov r1, #0x0 - bl ToggleBgLayer - mov r0, #0x6 - mov r1, #0x0 - bl ToggleBgLayer - mov r0, #0x7 - mov r1, #0x0 - bl ToggleBgLayer - ldr r0, [sp, #0x10] - mov r1, #0x0 - bl FreeBgTilemapBuffer - ldr r0, [sp, #0x10] - bl FreeToHeap - add sp, #0x24 - pop {r4-r7, pc} - nop -_02034368: .word 0xFFFFE0FF -_0203436C: .word 0x04001000 -_02034370: .word gMain + 0x60 -_02034374: .word 0x04000050 -_02034378: .word 0x04001050 -_0203437C: .word 0xFFFF1FFF -_02034380: .word UNK_020EED2C -_02034384: .word UNK_020EED00 -_02034388: .word UNK_020EED10 -_0203438C: .word 0x000001F7 -_02034390: .word 0x00006C21 -_02034394: .word 0x00000265 -_02034398: .word UNK_020EECF8 -_0203439C: .word 0x04000130 -_020343A0: .word 0x027FFFA8 -_020343A4: .word 0x00002FFF diff --git a/arm9/global.inc b/arm9/global.inc index 086d9b5f..4d1057b4 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -2472,7 +2472,7 @@ .extern FUN_02033F04 .extern FUN_02033F20 .extern FUN_02033F70 -.extern FUN_02034188 +.extern ShowWFCUserInfoWarning .extern FUN_02034494 .extern FUN_020344AC .extern FUN_020344D0 diff --git a/arm9/src/main.c b/arm9/src/main.c index 46f8add7..11d22cfe 100644 --- a/arm9/src/main.c +++ b/arm9/src/main.c @@ -14,6 +14,7 @@ #include "timer3.h" #include "unk_02031734.h" #include "unk_0202F150.h" +#include "unk_02034188.h" #include "module_52.h" #include "font.h" @@ -29,7 +30,6 @@ struct UnkStruct_02016FA8 UNK_02016FA8; extern void FUN_02022294(void); extern void GF_InitRTCWork(void); extern int FUN_020337E8(int); -extern void FUN_02034188(int, int); extern void FUN_02089D90(int); extern void FUN_0200A2AC(void); extern void FUN_02015E30(void); @@ -69,7 +69,7 @@ THUMB_FUNC void NitroMain(void) InitSoundData(Sav2_Chatot_get(UNK_02016FA8.unk18), Sav2_PlayerData_GetOptionsAddr(UNK_02016FA8.unk18)); Init_Timer3(); if (FUN_020337E8(3) == 3) - FUN_02034188(3, 0); + ShowWFCUserInfoWarning(3, 0); if (FUN_020227FC(UNK_02016FA8.unk18) == 0) { FUN_02089D90(0); diff --git a/arm9/src/unk_02034188.c b/arm9/src/unk_02034188.c new file mode 100644 index 00000000..1872a8cc --- /dev/null +++ b/arm9/src/unk_02034188.c @@ -0,0 +1,151 @@ +#include "global.h" +#include "bg_window.h" +#include "filesystem.h" +#include "game_init.h" +#include "GX_layers.h" +#include "main.h" +#include "msgdata.h" +#include "msgdata/msg.naix" +#include "PAD_pad.h" +#include "string16.h" +#include "text.h" +#include "unk_02034188.h" + +extern void FUN_02002ED0(enum GFBgLayer layer, u32 base_addr, u32 heap_id); +extern void FUN_0200A274(fx32 brightness, fx32, u32); +extern void FUN_0200CB00(struct BgConfig* bg_config, enum GFBgLayer layer, u32 num_tiles, u32, u8, u32 heap_id); +extern void FUN_0200CCA4(struct Window* window, BOOL copy_to_vram, u16 fill_value, u32 palette_num); +extern void FUN_0200E394(BOOL set_brightness_on_bottom_screen); +extern void FUN_0200E3A0(BOOL set_brightness_on_bottom_screen, s32); + +static const struct WindowTemplate sWFCWarningMsgWindowTemplate = { + .bgId = GF_BG_LYR_MAIN_0, + .tilemapLeft = 3, + .tilemapTop = 3, + .width = 26, + .height = 18, + .paletteNum = 0x01, + .baseTile = 0x23, +}; + +static const struct GraphicsModes sWFCWarningMsgGraphicsModes = { + .dispMode = GX_DISPMODE_GRAPHICS, + .bgMode = GX_BGMODE_0, + .subMode = GX_BGMODE_0, + ._2d3dMode = GX_BG0_AS_2D, +}; + +static const struct BgTemplate sWFCWarningMsgBgTemplate = { + .x = 0, + .y = 0, + .bufferSize = 0x800, + .baseTile = 0, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, + .screenBase = GX_BG_SCRBASE_0x0000, + .charBase = GX_BG_CHARBASE_0x18000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 1, + .areaOver = GX_BG_AREAOVER_XLU, + .unk17 = 0, + .mosaic = FALSE, +}; + +static const struct GraphicsBanks sWFCWarningMsgGraphicsBanks = { + .bg = 3, + .bgextpltt = 0, + .subbg = 0, + .subbgextpltt = 0, + .obj = 0, + .objextpltt = 0, + .subobj = 0, + .subobjextpltt = 0, + .tex = 0, + .texpltt = 0, +}; + +THUMB_FUNC void ShowWFCUserInfoWarning(u32 heap_id, u32 a1) +{ +#pragma unused(a1) + struct Window window; + + FUN_0200E3A0(PM_LCD_TOP, 0); + FUN_0200E3A0(PM_LCD_BOTTOM, 0); + + FUN_02015EF4(); + Main_SetVBlankIntrCB(NULL, NULL); + FUN_02015F34(NULL, NULL); + + GX_DisableEngineALayers(); + GX_DisableEngineBLayers(); + reg_GX_DISPCNT &= ~REG_GX_DISPCNT_DISPLAY_MASK; + reg_GXS_DB_DISPCNT &= ~REG_GX_DISPCNT_DISPLAY_MASK; + + SetKeyRepeatTimers(4, 8); + + gMain.unk65 = 0; + + GX_SwapDisplay(); + reg_G2_BLDCNT = 0; + reg_G2S_DB_BLDCNT = 0; + reg_GX_DISPCNT &= ~(REG_GX_DISPCNT_OW_MASK | REG_GX_DISPCNT_W1_MASK | REG_GX_DISPCNT_W0_MASK); + reg_GXS_DB_DISPCNT &= ~(REG_GXS_DB_DISPCNT_OW_MASK | REG_GXS_DB_DISPCNT_W1_MASK | REG_GXS_DB_DISPCNT_W0_MASK); + GX_SetBanks(&sWFCWarningMsgGraphicsBanks); + + struct BgConfig* bg_config = BgConfig_Alloc(heap_id); + + SetBothScreensModesAndDisable(&sWFCWarningMsgGraphicsModes); + + InitBgFromTemplate(bg_config, 0, &sWFCWarningMsgBgTemplate, 0); + BgClearTilemapBufferAndCommit(bg_config, 0); + FUN_0200CB00(bg_config, GF_BG_LYR_MAIN_0, 0x01F7, 2, 0, heap_id); + FUN_02002ED0(GF_BG_LYR_MAIN_0, 0x20, heap_id); + BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, heap_id); + BG_SetMaskColor(GF_BG_LYR_MAIN_0, 0x6C21); + BG_SetMaskColor(GF_BG_LYR_SUB_0, 0x6C21); + + struct MsgData* warning_messages_data = NewMsgDataFromNarc(1, NARC_MSGDATA_MSG, NARC_msg_narc_0613_bin, heap_id); + struct String* warning_message = String_ctor(384, heap_id); + FUN_0201BD5C(); + AddWindow(bg_config, &window, &sWFCWarningMsgWindowTemplate); + FillWindowPixelRect(&window, 0xF, 0, 0, 208, 144); + FUN_0200CCA4(&window, FALSE, 0x01F7, 2); + + ReadMsgDataIntoString(warning_messages_data, 15, warning_message); + AddTextPrinterParameterized(&window, 0, warning_message, 0, 0, 0, 0); + String_dtor(warning_message); + + GX_BothDispOn(); + FUN_0200E394(0); + FUN_0200E394(1); + FUN_0200A274(0, 0x3F, 3); + + while (TRUE) + { + u16 pressed_buttons = PAD_Read(); + + HandleDSLidAction(); + + if (pressed_buttons & PAD_BUTTON_A) + { + break; + } + + OS_WaitIrq(TRUE, OS_IE_V_BLANK); + } + + RemoveWindow(&window); + DestroyMsgData(warning_messages_data); + + ToggleBgLayer(GF_BG_LYR_MAIN_0, GX_LAYER_TOGGLE_OFF); + ToggleBgLayer(GF_BG_LYR_MAIN_1, GX_LAYER_TOGGLE_OFF); + ToggleBgLayer(GF_BG_LYR_MAIN_2, GX_LAYER_TOGGLE_OFF); + ToggleBgLayer(GF_BG_LYR_MAIN_3, GX_LAYER_TOGGLE_OFF); + ToggleBgLayer(GF_BG_LYR_SUB_0, GX_LAYER_TOGGLE_OFF); + ToggleBgLayer(GF_BG_LYR_SUB_1, GX_LAYER_TOGGLE_OFF); + ToggleBgLayer(GF_BG_LYR_SUB_2, GX_LAYER_TOGGLE_OFF); + ToggleBgLayer(GF_BG_LYR_SUB_3, GX_LAYER_TOGGLE_OFF); + + FreeBgTilemapBuffer(bg_config, 0); + FreeToHeap(bg_config); +} diff --git a/include/unk_02034188.h b/include/unk_02034188.h new file mode 100644 index 00000000..02ade1f0 --- /dev/null +++ b/include/unk_02034188.h @@ -0,0 +1,6 @@ +#ifndef POKEDIAMOND_UNK_02034188_H +#define POKEDIAMOND_UNK_02034188_H + +void ShowWFCUserInfoWarning(u32 heap_id, u32 a1); + +#endif -- cgit v1.2.3 From 0b35e2ff770f77b17504f7e72780f8af6c4a6e2d Mon Sep 17 00:00:00 2001 From: GliMusings Date: Wed, 30 Jun 2021 19:11:50 -0500 Subject: unk_02064E20 matching --- arm9/asm/unk_02064E20.s | 25 ------------------------- arm9/src/unk_02064E20.c | 18 ++++++++++++++++++ include/unk_02064E20.h | 6 ++++++ 3 files changed, 24 insertions(+), 25 deletions(-) delete mode 100644 arm9/asm/unk_02064E20.s create mode 100644 arm9/src/unk_02064E20.c create mode 100644 include/unk_02064E20.h diff --git a/arm9/asm/unk_02064E20.s b/arm9/asm/unk_02064E20.s deleted file mode 100644 index 19ada5a3..00000000 --- a/arm9/asm/unk_02064E20.s +++ /dev/null @@ -1,25 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start FUN_02064E20 -FUN_02064E20: ; 0x02064E20 - push {r4, lr} - bl ScriptEnvironment_GetSav2Ptr - bl FUN_02024ED8 - add r4, r0, #0x0 - bl FUN_020254B4 - cmp r0, #0x6 - beq _02064E48 - add r0, r4, #0x0 - mov r1, #0x6 - bl FUN_02025490 - add r0, r4, #0x0 - mov r1, #0x6 - bl FUN_020254A0 - mov r1, #0x2 - strh r1, [r0, #0x0] -_02064E48: - pop {r4, pc} - .balign 4 diff --git a/arm9/src/unk_02064E20.c b/arm9/src/unk_02064E20.c new file mode 100644 index 00000000..270004c5 --- /dev/null +++ b/arm9/src/unk_02064E20.c @@ -0,0 +1,18 @@ +#include "global.h" +#include "script.h" +#include "scrcmd.h" +#include "unk_02025484.h" +#include "unk_02024E64.h" +#include "unk_02064E20.h" + +THUMB_FUNC void FUN_02064E20(struct UnkSavStruct80* unk0) +{ + struct unk_2025484 * r4 = (struct unk_2025484 *)FUN_02024ED8(ScriptEnvironment_GetSav2Ptr(unk0)); + if((u32)FUN_020254B4(r4) == 6) + { + return; + } + FUN_02025490(r4, 6); + u16 * ptr0 = (u16 *)FUN_020254A0(r4 , 6); + ptr0[0] = 2; +} diff --git a/include/unk_02064E20.h b/include/unk_02064E20.h new file mode 100644 index 00000000..5a00f5d1 --- /dev/null +++ b/include/unk_02064E20.h @@ -0,0 +1,6 @@ +#ifndef POKEDIAMOND_UNK_02064E20_H +#define POKEDIAMOND_UNK_02064E20_H + +void FUN_02064E20(struct UnkSavStruct80* unk0); + +#endif // POKEDIAMOND_UNK_02064E20_H -- cgit v1.2.3 From 2b644a764835f018c78778f99efbfbaaa3471016 Mon Sep 17 00:00:00 2001 From: GliMusings Date: Wed, 30 Jun 2021 20:18:05 -0500 Subject: unk_020061E8 matching --- arm9/asm/unk_020061E8.s | 45 --------------------------------------------- arm9/src/unk_020061E8.c | 35 +++++++++++++++++++++++++++++++++++ include/unk_020061E8.h | 9 +++++++++ 3 files changed, 44 insertions(+), 45 deletions(-) delete mode 100644 arm9/asm/unk_020061E8.s create mode 100644 arm9/src/unk_020061E8.c create mode 100644 include/unk_020061E8.h diff --git a/arm9/asm/unk_020061E8.s b/arm9/asm/unk_020061E8.s deleted file mode 100644 index 22f390c7..00000000 --- a/arm9/asm/unk_020061E8.s +++ /dev/null @@ -1,45 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - .section .text - - thumb_func_start FUN_020061E8 -FUN_020061E8: ; 0x020061E8 - push {r3-r7, lr} - add r5, r1, #0x0 - add r6, r0, #0x0 - add r7, r2, #0x0 - cmp r5, #0x0 - beq _0200620C - add r0, r3, #0x0 - bl AllocFromHeap - add r4, r0, #0x0 - bne _02006202 - mov r0, #0x0 - pop {r3-r7, pc} -_02006202: - mov r1, #0x0 - add r2, r5, #0x0 - bl memset - b _0200620E -_0200620C: - mov r4, #0x0 -_0200620E: - add r0, r6, #0x0 - add r1, r4, #0x0 - add r2, r7, #0x0 - bl FUN_0200CA44 - pop {r3-r7, pc} - .balign 4 - - thumb_func_start FUN_0200621C -FUN_0200621C: ; 0x0200621C - push {r4, lr} - add r4, r0, #0x0 - bl FUN_0201B6C8 - cmp r0, #0x0 - beq _0200622C - bl FreeToHeap -_0200622C: - add r0, r4, #0x0 - bl FUN_0200CAB4 - pop {r4, pc} diff --git a/arm9/src/unk_020061E8.c b/arm9/src/unk_020061E8.c new file mode 100644 index 00000000..da8eac1b --- /dev/null +++ b/arm9/src/unk_020061E8.c @@ -0,0 +1,35 @@ +#include "global.h" +#include "heap.h" +#include "unk_0200CA44.h" +#include "unk_020061E8.h" + +extern struct TextPrinter *FUN_0201B6C8(void); + +THUMB_FUNC BOOL FUN_020061E8(void (*r0)(u32, struct TextPrinter *), u32 r1, u32 r2, u32 r3) +{ + void * r4; + if(r1 != 0) + { + r4 = AllocFromHeap(r3, r1); + if(r4 == 0) + { + return FALSE; + } // _02006202 + memset(r4, 0, r1); + } // _0200620C + else + { + r4 = NULL; + } // _0200620E + return FUN_0200CA44(r0, r4, r2); +} + +THUMB_FUNC void FUN_0200621C(s32 r4) +{ + struct TextPrinter * r0 = FUN_0201B6C8(); + if(r0 != NULL) + { + FreeToHeap(r0); + } + FUN_0200CAB4(r4); +} diff --git a/include/unk_020061E8.h b/include/unk_020061E8.h new file mode 100644 index 00000000..a2d571bf --- /dev/null +++ b/include/unk_020061E8.h @@ -0,0 +1,9 @@ +#ifndef POKEDIAMOND_UNK_020061E8_H +#define POKEDIAMOND_UNK_020061E8_H + +#include "text.h" + +BOOL FUN_020061E8(void (*r0)(u32, struct TextPrinter *), u32 r1, u32 r2, u32 r3); +void FUN_0200621C(s32 r0); + +#endif // POKEDIAMOND_UNK_020061E8_H -- cgit v1.2.3 From 24f7cbde0538943fed6ab2185122e7d0c0522795 Mon Sep 17 00:00:00 2001 From: GliMusings Date: Wed, 30 Jun 2021 20:42:04 -0500 Subject: unk_020222E8 matching --- arm9/asm/unk_020222E8.s | 46 ---------------------------------------------- arm9/src/palette.c | 5 +---- arm9/src/unk_020222E8.c | 33 +++++++++++++++++++++++++++++++++ include/unk_020222E8.h | 11 +++++++++++ 4 files changed, 45 insertions(+), 50 deletions(-) delete mode 100644 arm9/asm/unk_020222E8.s create mode 100644 arm9/src/unk_020222E8.c create mode 100644 include/unk_020222E8.h diff --git a/arm9/asm/unk_020222E8.s b/arm9/asm/unk_020222E8.s deleted file mode 100644 index 047712a5..00000000 --- a/arm9/asm/unk_020222E8.s +++ /dev/null @@ -1,46 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start FUN_020222E8 -FUN_020222E8: ; 0x020222E8 - mov r0, #0x5 - lsl r0, r0, #0x18 - bx lr - .balign 4 - - thumb_func_start FUN_020222F0 -FUN_020222F0: ; 0x020222F0 - mov r0, #0x2 - lsl r0, r0, #0x8 - bx lr - .balign 4 - - thumb_func_start FUN_020222F8 -FUN_020222F8: ; 0x020222F8 - ldr r0, _020222FC ; =0x05000400 - bx lr - .balign 4 -_020222FC: .word 0x05000400 - - thumb_func_start FUN_02022300 -FUN_02022300: ; 0x02022300 - mov r0, #0x2 - lsl r0, r0, #0x8 - bx lr - .balign 4 - - thumb_func_start FUN_02022308 -FUN_02022308: ; 0x02022308 - ldr r0, _0202230C ; =0x05000200 - bx lr - .balign 4 -_0202230C: .word 0x05000200 - - thumb_func_start FUN_02022310 -FUN_02022310: ; 0x02022310 - ldr r0, _02022314 ; =0x05000600 - bx lr - .balign 4 -_02022314: .word 0x05000600 diff --git a/arm9/src/palette.c b/arm9/src/palette.c index 6726a0ec..e4c42cc4 100644 --- a/arm9/src/palette.c +++ b/arm9/src/palette.c @@ -3,11 +3,8 @@ #include "MI_memory.h" #include "gf_gfx_loader.h" #include "unk_0200CA44.h" +#include "unk_020222E8.h" -extern void *FUN_020222E8(); -extern void *FUN_020222F8(); -extern void *FUN_02022308(); -extern void *FUN_02022310(); extern int abs(int); THUMB_FUNC struct PaletteData *FUN_02002FD0(u32 heap_id) diff --git a/arm9/src/unk_020222E8.c b/arm9/src/unk_020222E8.c new file mode 100644 index 00000000..30a2a2c4 --- /dev/null +++ b/arm9/src/unk_020222E8.c @@ -0,0 +1,33 @@ +#include "global.h" +#include "unk_020222E8.h" + +THUMB_FUNC void * FUN_020222E8() +{ + return 0x5 << 0x18; +} + +THUMB_FUNC void * FUN_020222F0() +{ + return 0x2 << 0x8; +} + +THUMB_FUNC void * FUN_020222F8() +{ + return 0x05000400; +} + +THUMB_FUNC void * FUN_02022300() +{ + return 0x2 << 0x8; +} + +THUMB_FUNC void * FUN_02022308() +{ + return 0x05000200; +} + +THUMB_FUNC void * FUN_02022310() +{ + return 0x05000600; +} + diff --git a/include/unk_020222E8.h b/include/unk_020222E8.h new file mode 100644 index 00000000..ac6e1932 --- /dev/null +++ b/include/unk_020222E8.h @@ -0,0 +1,11 @@ +#ifndef POKEDIAMOND_UNK_020222E8_H +#define POKEDIAMOND_UNK_020222E8_H + +void * FUN_020222E8(); +void * FUN_020222F0(); +void * FUN_020222F8(); +void * FUN_02022300(); +void * FUN_02022308(); +void * FUN_02022310(); + +#endif // POKEDIAMOND_UNK_020222E8_H -- cgit v1.2.3 From 5ddd65e0c3e9d669252c4d1e0bab3ca652afe171 Mon Sep 17 00:00:00 2001 From: GliMusings Date: Wed, 30 Jun 2021 20:49:53 -0500 Subject: Beautify --- arm9/src/unk_020061E8.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arm9/src/unk_020061E8.c b/arm9/src/unk_020061E8.c index da8eac1b..424fea34 100644 --- a/arm9/src/unk_020061E8.c +++ b/arm9/src/unk_020061E8.c @@ -14,13 +14,13 @@ THUMB_FUNC BOOL FUN_020061E8(void (*r0)(u32, struct TextPrinter *), u32 r1, u32 if(r4 == 0) { return FALSE; - } // _02006202 + } memset(r4, 0, r1); - } // _0200620C + } else { r4 = NULL; - } // _0200620E + } return FUN_0200CA44(r0, r4, r2); } -- cgit v1.2.3 From c2bf79632520de7963788973b32649db3c55ff97 Mon Sep 17 00:00:00 2001 From: GliMusings Date: Wed, 30 Jun 2021 21:19:22 -0500 Subject: Added some includes --- arm9/src/unk_02064E20.c | 1 - include/unk_020061E8.h | 1 + include/unk_02064E20.h | 2 ++ 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arm9/src/unk_02064E20.c b/arm9/src/unk_02064E20.c index 270004c5..8586981b 100644 --- a/arm9/src/unk_02064E20.c +++ b/arm9/src/unk_02064E20.c @@ -1,5 +1,4 @@ #include "global.h" -#include "script.h" #include "scrcmd.h" #include "unk_02025484.h" #include "unk_02024E64.h" diff --git a/include/unk_020061E8.h b/include/unk_020061E8.h index a2d571bf..d94ea88f 100644 --- a/include/unk_020061E8.h +++ b/include/unk_020061E8.h @@ -1,6 +1,7 @@ #ifndef POKEDIAMOND_UNK_020061E8_H #define POKEDIAMOND_UNK_020061E8_H +#include "nitro/types.h" #include "text.h" BOOL FUN_020061E8(void (*r0)(u32, struct TextPrinter *), u32 r1, u32 r2, u32 r3); diff --git a/include/unk_02064E20.h b/include/unk_02064E20.h index 5a00f5d1..a9bcd0e0 100644 --- a/include/unk_02064E20.h +++ b/include/unk_02064E20.h @@ -1,6 +1,8 @@ #ifndef POKEDIAMOND_UNK_02064E20_H #define POKEDIAMOND_UNK_02064E20_H +#include "script.h" + void FUN_02064E20(struct UnkSavStruct80* unk0); #endif // POKEDIAMOND_UNK_02064E20_H -- cgit v1.2.3 From 50cfe8341dd239857d0d1a0c87dbb08849de51d0 Mon Sep 17 00:00:00 2001 From: tgsm Date: Wed, 30 Jun 2021 21:47:57 -0500 Subject: Name unk_02034188 -> wfc_user_info_warning --- arm9/arm9.lsf | 2 +- arm9/src/main.c | 2 +- arm9/src/unk_02034188.c | 151 --------------------------------------- arm9/src/wfc_user_info_warning.c | 151 +++++++++++++++++++++++++++++++++++++++ include/unk_02034188.h | 6 -- include/wfc_user_info_warning.h | 6 ++ 6 files changed, 159 insertions(+), 159 deletions(-) delete mode 100644 arm9/src/unk_02034188.c create mode 100644 arm9/src/wfc_user_info_warning.c delete mode 100644 include/unk_02034188.h create mode 100644 include/wfc_user_info_warning.h diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index 0f29630c..8b49cc27 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -139,7 +139,7 @@ Static arm9 Object unk_02033874.o Object unk_02033B68.o Object unk_02033F50.o - Object unk_02034188.o + Object wfc_user_info_warning.o Object unk_020343A8.o Object map_header.o Object unk_02034A28.o diff --git a/arm9/src/main.c b/arm9/src/main.c index 11d22cfe..d1a60190 100644 --- a/arm9/src/main.c +++ b/arm9/src/main.c @@ -14,7 +14,7 @@ #include "timer3.h" #include "unk_02031734.h" #include "unk_0202F150.h" -#include "unk_02034188.h" +#include "wfc_user_info_warning.h" #include "module_52.h" #include "font.h" diff --git a/arm9/src/unk_02034188.c b/arm9/src/unk_02034188.c deleted file mode 100644 index 1872a8cc..00000000 --- a/arm9/src/unk_02034188.c +++ /dev/null @@ -1,151 +0,0 @@ -#include "global.h" -#include "bg_window.h" -#include "filesystem.h" -#include "game_init.h" -#include "GX_layers.h" -#include "main.h" -#include "msgdata.h" -#include "msgdata/msg.naix" -#include "PAD_pad.h" -#include "string16.h" -#include "text.h" -#include "unk_02034188.h" - -extern void FUN_02002ED0(enum GFBgLayer layer, u32 base_addr, u32 heap_id); -extern void FUN_0200A274(fx32 brightness, fx32, u32); -extern void FUN_0200CB00(struct BgConfig* bg_config, enum GFBgLayer layer, u32 num_tiles, u32, u8, u32 heap_id); -extern void FUN_0200CCA4(struct Window* window, BOOL copy_to_vram, u16 fill_value, u32 palette_num); -extern void FUN_0200E394(BOOL set_brightness_on_bottom_screen); -extern void FUN_0200E3A0(BOOL set_brightness_on_bottom_screen, s32); - -static const struct WindowTemplate sWFCWarningMsgWindowTemplate = { - .bgId = GF_BG_LYR_MAIN_0, - .tilemapLeft = 3, - .tilemapTop = 3, - .width = 26, - .height = 18, - .paletteNum = 0x01, - .baseTile = 0x23, -}; - -static const struct GraphicsModes sWFCWarningMsgGraphicsModes = { - .dispMode = GX_DISPMODE_GRAPHICS, - .bgMode = GX_BGMODE_0, - .subMode = GX_BGMODE_0, - ._2d3dMode = GX_BG0_AS_2D, -}; - -static const struct BgTemplate sWFCWarningMsgBgTemplate = { - .x = 0, - .y = 0, - .bufferSize = 0x800, - .baseTile = 0, - .size = GF_BG_SCR_SIZE_256x256, - .colorMode = GX_BG_COLORMODE_16, - .screenBase = GX_BG_SCRBASE_0x0000, - .charBase = GX_BG_CHARBASE_0x18000, - .bgExtPltt = GX_BG_EXTPLTT_01, - .priority = 1, - .areaOver = GX_BG_AREAOVER_XLU, - .unk17 = 0, - .mosaic = FALSE, -}; - -static const struct GraphicsBanks sWFCWarningMsgGraphicsBanks = { - .bg = 3, - .bgextpltt = 0, - .subbg = 0, - .subbgextpltt = 0, - .obj = 0, - .objextpltt = 0, - .subobj = 0, - .subobjextpltt = 0, - .tex = 0, - .texpltt = 0, -}; - -THUMB_FUNC void ShowWFCUserInfoWarning(u32 heap_id, u32 a1) -{ -#pragma unused(a1) - struct Window window; - - FUN_0200E3A0(PM_LCD_TOP, 0); - FUN_0200E3A0(PM_LCD_BOTTOM, 0); - - FUN_02015EF4(); - Main_SetVBlankIntrCB(NULL, NULL); - FUN_02015F34(NULL, NULL); - - GX_DisableEngineALayers(); - GX_DisableEngineBLayers(); - reg_GX_DISPCNT &= ~REG_GX_DISPCNT_DISPLAY_MASK; - reg_GXS_DB_DISPCNT &= ~REG_GX_DISPCNT_DISPLAY_MASK; - - SetKeyRepeatTimers(4, 8); - - gMain.unk65 = 0; - - GX_SwapDisplay(); - reg_G2_BLDCNT = 0; - reg_G2S_DB_BLDCNT = 0; - reg_GX_DISPCNT &= ~(REG_GX_DISPCNT_OW_MASK | REG_GX_DISPCNT_W1_MASK | REG_GX_DISPCNT_W0_MASK); - reg_GXS_DB_DISPCNT &= ~(REG_GXS_DB_DISPCNT_OW_MASK | REG_GXS_DB_DISPCNT_W1_MASK | REG_GXS_DB_DISPCNT_W0_MASK); - GX_SetBanks(&sWFCWarningMsgGraphicsBanks); - - struct BgConfig* bg_config = BgConfig_Alloc(heap_id); - - SetBothScreensModesAndDisable(&sWFCWarningMsgGraphicsModes); - - InitBgFromTemplate(bg_config, 0, &sWFCWarningMsgBgTemplate, 0); - BgClearTilemapBufferAndCommit(bg_config, 0); - FUN_0200CB00(bg_config, GF_BG_LYR_MAIN_0, 0x01F7, 2, 0, heap_id); - FUN_02002ED0(GF_BG_LYR_MAIN_0, 0x20, heap_id); - BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, heap_id); - BG_SetMaskColor(GF_BG_LYR_MAIN_0, 0x6C21); - BG_SetMaskColor(GF_BG_LYR_SUB_0, 0x6C21); - - struct MsgData* warning_messages_data = NewMsgDataFromNarc(1, NARC_MSGDATA_MSG, NARC_msg_narc_0613_bin, heap_id); - struct String* warning_message = String_ctor(384, heap_id); - FUN_0201BD5C(); - AddWindow(bg_config, &window, &sWFCWarningMsgWindowTemplate); - FillWindowPixelRect(&window, 0xF, 0, 0, 208, 144); - FUN_0200CCA4(&window, FALSE, 0x01F7, 2); - - ReadMsgDataIntoString(warning_messages_data, 15, warning_message); - AddTextPrinterParameterized(&window, 0, warning_message, 0, 0, 0, 0); - String_dtor(warning_message); - - GX_BothDispOn(); - FUN_0200E394(0); - FUN_0200E394(1); - FUN_0200A274(0, 0x3F, 3); - - while (TRUE) - { - u16 pressed_buttons = PAD_Read(); - - HandleDSLidAction(); - - if (pressed_buttons & PAD_BUTTON_A) - { - break; - } - - OS_WaitIrq(TRUE, OS_IE_V_BLANK); - } - - RemoveWindow(&window); - DestroyMsgData(warning_messages_data); - - ToggleBgLayer(GF_BG_LYR_MAIN_0, GX_LAYER_TOGGLE_OFF); - ToggleBgLayer(GF_BG_LYR_MAIN_1, GX_LAYER_TOGGLE_OFF); - ToggleBgLayer(GF_BG_LYR_MAIN_2, GX_LAYER_TOGGLE_OFF); - ToggleBgLayer(GF_BG_LYR_MAIN_3, GX_LAYER_TOGGLE_OFF); - ToggleBgLayer(GF_BG_LYR_SUB_0, GX_LAYER_TOGGLE_OFF); - ToggleBgLayer(GF_BG_LYR_SUB_1, GX_LAYER_TOGGLE_OFF); - ToggleBgLayer(GF_BG_LYR_SUB_2, GX_LAYER_TOGGLE_OFF); - ToggleBgLayer(GF_BG_LYR_SUB_3, GX_LAYER_TOGGLE_OFF); - - FreeBgTilemapBuffer(bg_config, 0); - FreeToHeap(bg_config); -} diff --git a/arm9/src/wfc_user_info_warning.c b/arm9/src/wfc_user_info_warning.c new file mode 100644 index 00000000..d9edd94c --- /dev/null +++ b/arm9/src/wfc_user_info_warning.c @@ -0,0 +1,151 @@ +#include "global.h" +#include "bg_window.h" +#include "filesystem.h" +#include "game_init.h" +#include "GX_layers.h" +#include "main.h" +#include "msgdata.h" +#include "msgdata/msg.naix" +#include "PAD_pad.h" +#include "string16.h" +#include "text.h" +#include "wfc_user_info_warning.h" + +extern void FUN_02002ED0(enum GFBgLayer layer, u32 base_addr, u32 heap_id); +extern void FUN_0200A274(fx32 brightness, fx32, u32); +extern void FUN_0200CB00(struct BgConfig* bg_config, enum GFBgLayer layer, u32 num_tiles, u32, u8, u32 heap_id); +extern void FUN_0200CCA4(struct Window* window, BOOL copy_to_vram, u16 fill_value, u32 palette_num); +extern void FUN_0200E394(BOOL set_brightness_on_bottom_screen); +extern void FUN_0200E3A0(BOOL set_brightness_on_bottom_screen, s32); + +static const struct WindowTemplate sWFCWarningMsgWindowTemplate = { + .bgId = GF_BG_LYR_MAIN_0, + .tilemapLeft = 3, + .tilemapTop = 3, + .width = 26, + .height = 18, + .paletteNum = 0x01, + .baseTile = 0x23, +}; + +static const struct GraphicsModes sWFCWarningMsgGraphicsModes = { + .dispMode = GX_DISPMODE_GRAPHICS, + .bgMode = GX_BGMODE_0, + .subMode = GX_BGMODE_0, + ._2d3dMode = GX_BG0_AS_2D, +}; + +static const struct BgTemplate sWFCWarningMsgBgTemplate = { + .x = 0, + .y = 0, + .bufferSize = 0x800, + .baseTile = 0, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, + .screenBase = GX_BG_SCRBASE_0x0000, + .charBase = GX_BG_CHARBASE_0x18000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 1, + .areaOver = GX_BG_AREAOVER_XLU, + .unk17 = 0, + .mosaic = FALSE, +}; + +static const struct GraphicsBanks sWFCWarningMsgGraphicsBanks = { + .bg = 3, + .bgextpltt = 0, + .subbg = 0, + .subbgextpltt = 0, + .obj = 0, + .objextpltt = 0, + .subobj = 0, + .subobjextpltt = 0, + .tex = 0, + .texpltt = 0, +}; + +THUMB_FUNC void ShowWFCUserInfoWarning(u32 heap_id, u32 a1) +{ +#pragma unused(a1) + struct Window window; + + FUN_0200E3A0(PM_LCD_TOP, 0); + FUN_0200E3A0(PM_LCD_BOTTOM, 0); + + FUN_02015EF4(); + Main_SetVBlankIntrCB(NULL, NULL); + FUN_02015F34(NULL, NULL); + + GX_DisableEngineALayers(); + GX_DisableEngineBLayers(); + reg_GX_DISPCNT &= ~REG_GX_DISPCNT_DISPLAY_MASK; + reg_GXS_DB_DISPCNT &= ~REG_GX_DISPCNT_DISPLAY_MASK; + + SetKeyRepeatTimers(4, 8); + + gMain.unk65 = 0; + + GX_SwapDisplay(); + reg_G2_BLDCNT = 0; + reg_G2S_DB_BLDCNT = 0; + reg_GX_DISPCNT &= ~(REG_GX_DISPCNT_OW_MASK | REG_GX_DISPCNT_W1_MASK | REG_GX_DISPCNT_W0_MASK); + reg_GXS_DB_DISPCNT &= ~(REG_GXS_DB_DISPCNT_OW_MASK | REG_GXS_DB_DISPCNT_W1_MASK | REG_GXS_DB_DISPCNT_W0_MASK); + GX_SetBanks(&sWFCWarningMsgGraphicsBanks); + + struct BgConfig* bg_config = BgConfig_Alloc(heap_id); + + SetBothScreensModesAndDisable(&sWFCWarningMsgGraphicsModes); + + InitBgFromTemplate(bg_config, 0, &sWFCWarningMsgBgTemplate, 0); + BgClearTilemapBufferAndCommit(bg_config, 0); + FUN_0200CB00(bg_config, GF_BG_LYR_MAIN_0, 0x01F7, 2, 0, heap_id); + FUN_02002ED0(GF_BG_LYR_MAIN_0, 0x20, heap_id); + BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, heap_id); + BG_SetMaskColor(GF_BG_LYR_MAIN_0, 0x6C21); + BG_SetMaskColor(GF_BG_LYR_SUB_0, 0x6C21); + + struct MsgData* warning_messages_data = NewMsgDataFromNarc(1, NARC_MSGDATA_MSG, NARC_msg_narc_0613_bin, heap_id); + struct String* warning_message = String_ctor(384, heap_id); + FUN_0201BD5C(); + AddWindow(bg_config, &window, &sWFCWarningMsgWindowTemplate); + FillWindowPixelRect(&window, 0xF, 0, 0, 208, 144); + FUN_0200CCA4(&window, FALSE, 0x01F7, 2); + + ReadMsgDataIntoString(warning_messages_data, 15, warning_message); + AddTextPrinterParameterized(&window, 0, warning_message, 0, 0, 0, 0); + String_dtor(warning_message); + + GX_BothDispOn(); + FUN_0200E394(0); + FUN_0200E394(1); + FUN_0200A274(0, 0x3F, 3); + + while (TRUE) + { + u16 pressed_buttons = PAD_Read(); + + HandleDSLidAction(); + + if (pressed_buttons & PAD_BUTTON_A) + { + break; + } + + OS_WaitIrq(TRUE, OS_IE_V_BLANK); + } + + RemoveWindow(&window); + DestroyMsgData(warning_messages_data); + + ToggleBgLayer(GF_BG_LYR_MAIN_0, GX_LAYER_TOGGLE_OFF); + ToggleBgLayer(GF_BG_LYR_MAIN_1, GX_LAYER_TOGGLE_OFF); + ToggleBgLayer(GF_BG_LYR_MAIN_2, GX_LAYER_TOGGLE_OFF); + ToggleBgLayer(GF_BG_LYR_MAIN_3, GX_LAYER_TOGGLE_OFF); + ToggleBgLayer(GF_BG_LYR_SUB_0, GX_LAYER_TOGGLE_OFF); + ToggleBgLayer(GF_BG_LYR_SUB_1, GX_LAYER_TOGGLE_OFF); + ToggleBgLayer(GF_BG_LYR_SUB_2, GX_LAYER_TOGGLE_OFF); + ToggleBgLayer(GF_BG_LYR_SUB_3, GX_LAYER_TOGGLE_OFF); + + FreeBgTilemapBuffer(bg_config, 0); + FreeToHeap(bg_config); +} diff --git a/include/unk_02034188.h b/include/unk_02034188.h deleted file mode 100644 index 02ade1f0..00000000 --- a/include/unk_02034188.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEDIAMOND_UNK_02034188_H -#define POKEDIAMOND_UNK_02034188_H - -void ShowWFCUserInfoWarning(u32 heap_id, u32 a1); - -#endif diff --git a/include/wfc_user_info_warning.h b/include/wfc_user_info_warning.h new file mode 100644 index 00000000..2ddb8890 --- /dev/null +++ b/include/wfc_user_info_warning.h @@ -0,0 +1,6 @@ +#ifndef POKEDIAMOND_WFC_USER_INFO_WARNING_H +#define POKEDIAMOND_WFC_USER_INFO_WARNING_H + +void ShowWFCUserInfoWarning(u32 heap_id, u32 a1); + +#endif -- cgit v1.2.3