From 015a7675e6ffcf234a856528a02e58d62a32f044 Mon Sep 17 00:00:00 2001 From: Gogume1er Date: Tue, 25 May 2021 00:27:09 +0200 Subject: decompile unk_020851B8 --- include/unk_020851B8.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 include/unk_020851B8.h (limited to 'include') diff --git a/include/unk_020851B8.h b/include/unk_020851B8.h new file mode 100644 index 00000000..63725aea --- /dev/null +++ b/include/unk_020851B8.h @@ -0,0 +1,15 @@ +#ifndef POKEDIAMOND_UNK_020851B8_H +#define POKEDIAMOND_UNK_020851B8_H + +struct UnkStruct_020851B8 { + u8 unk00[0xC]; +}; + +struct UnkStruct_020851B8 *FUN_020851B8(u32 heap_id); +void FUN_020851DC(struct UnkStruct_020851B8 *param0, u32 param1, BOOL param2); +void FUN_020851F8(struct UnkStruct_020851B8 *param0, u8 param1, u8 param2, u8 param3); +void FUN_02085200(u32 *param0, u16 param1); +u32 FUN_02085224(u32 *param0, u16 param1); +void FUN_0208524C(struct UnkStruct_020851B8 *param0, u8 *param1, u8 *param2); + +#endif // POKEDIAMOND_UNK_020851B8_H -- cgit v1.2.3 From efc5b8945753cfef80ff77c6c05f26034c279e6b Mon Sep 17 00:00:00 2001 From: Gogume1er Date: Tue, 25 May 2021 09:58:45 +0200 Subject: fix structure & minor changes --- include/unk_020851B8.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/unk_020851B8.h b/include/unk_020851B8.h index 63725aea..ca47a91c 100644 --- a/include/unk_020851B8.h +++ b/include/unk_020851B8.h @@ -2,14 +2,18 @@ #define POKEDIAMOND_UNK_020851B8_H struct UnkStruct_020851B8 { - u8 unk00[0xC]; + u32 flags[2]; + u8 unk_8; + u8 unk_9; + u8 unk_A; + u8 unk_B; }; struct UnkStruct_020851B8 *FUN_020851B8(u32 heap_id); void FUN_020851DC(struct UnkStruct_020851B8 *param0, u32 param1, BOOL param2); void FUN_020851F8(struct UnkStruct_020851B8 *param0, u8 param1, u8 param2, u8 param3); -void FUN_02085200(u32 *param0, u16 param1); -u32 FUN_02085224(u32 *param0, u16 param1); +void FUN_02085200(struct UnkStruct_020851B8 *param0, u16 param1); +u8 FUN_02085224(struct UnkStruct_020851B8 *param0, u16 param1); void FUN_0208524C(struct UnkStruct_020851B8 *param0, u8 *param1, u8 *param2); #endif // POKEDIAMOND_UNK_020851B8_H -- cgit v1.2.3 From af472505c60f7a0463e8195e9039af4806b9d42b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 29 May 2021 20:57:36 -0400 Subject: Document game_init.c --- include/game_init.h | 26 +++++++++++++------------- include/main.h | 30 +++++++++++++++--------------- 2 files changed, 28 insertions(+), 28 deletions(-) (limited to 'include') diff --git a/include/game_init.h b/include/game_init.h index 7a6e34fb..6aaeb6b4 100644 --- a/include/game_init.h +++ b/include/game_init.h @@ -14,21 +14,21 @@ void Main_HBlankIntr(BOOL a0); void FUN_02015FC8(void); void InitSystemForTheGame(void); void InitGraphicMemory(void); -void * FUN_020161A4(u32 heap_id, const char * path); -void FUN_020161F8(const char * path, void ** ptr); -u32 FUN_02016230(const s8 * str); -int FUN_020162A0(u32 a0); -int FUN_020162C8(void * a0, u32 a1); -void FUN_020162FC(void); -void * FUN_02016324(const s8 * str, u32 heap_id); -void FUN_020163BC(void); +void * AllocAndReadFile(u32 heap_id, const char * path); +void OpenAndReadWholeFile(const char * path, void ** ptr); +u32 GetFilenameHash(const s8 * str); +int GetFileCacheId(u32 hash); +int AddFileToCache(void * contents, u32 hash); +void ClearFileCache(void); +void * OpenFileCached(const s8 * str, u32 heap_id); +void InitKeypadAndTouchpad(void); void FUN_02016438(u8 a0); void FUN_02016444(u8 a0); void FUN_02016454(u8 a0); -void FUN_02016464(void); -void FUN_02016568(void); -void FUN_0201669C(int x, int y); -void FUN_020166A8(u8 a0); -void FUN_020166B8(u8 a0); +void ReadKeypadAndTocuhpad(void); +void ApplyButtonModeToInput(void); +void SetKeyRepeatTimers(int x, int y); +void SetSoftResetDisableMask(u8 a0); +void ClearSoftResetDisableMask(u8 a0); #endif //POKEDIAMOND_GAME_INIT_H diff --git a/include/main.h b/include/main.h index 9227d9a8..ba4d7bc2 100644 --- a/include/main.h +++ b/include/main.h @@ -79,26 +79,26 @@ struct Main s32 unk28; u32 unk2C; s32 unk30; - u32 unk34; - u32 unk38; - u32 unk3C; - u32 unk40; - u32 unk44; + u32 buttonMode; + u32 heldKeysRaw; + u32 newKeysRaw; + u32 newAndRepeatedKeysRaw; + u32 heldKeys; u32 newKeys; u32 newAndRepeatedKeys; - s32 unk50; - s32 unk54; - s32 unk58; - u16 unk5C; - u16 unk5E; - u16 unk60; - u16 unk62; - u8 unk64; + s32 keyRepeatCounter; + s32 keyRepeatContinueDelay; + s32 keyRepeatStartDelay; + u16 touchX; + u16 touchY; + u16 touchNew; + u16 touchHeld; + u8 touchpadReadAuto; u8 unk65; u8 unk66; u8 unk67; - u8 unk68; - u8 padding_69[3]; + u8 softResetDisabled; + u8 padding_69[3]; // nice s32 unk6C; }; -- cgit v1.2.3 From 9da7dd90041b785cb156069ccdf96996d9a162e2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 30 May 2021 08:54:50 -0400 Subject: Refactor heap.c using NNS types, 1 --- include/game_init.h | 4 ++-- include/heap.h | 19 +++++++++++++------ include/unk_02016B94.h | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/game_init.h b/include/game_init.h index 6aaeb6b4..77484689 100644 --- a/include/game_init.h +++ b/include/game_init.h @@ -9,8 +9,8 @@ void FUN_02015EF4(void); void Main_SetVBlankIntrCB(void (*a0)(void *), void * a1); void FUN_02015F1C(void); BOOL FUN_02015F34(void (*a0)(void *), void * a1); -void FUN_02015F6C(void); -void Main_HBlankIntr(BOOL a0); +void Main_CallHBlankCallback(void); +void Main_ToggleHBlankInterrupt(BOOL enableFlag); void FUN_02015FC8(void); void InitSystemForTheGame(void); void InitGraphicMemory(void); diff --git a/include/heap.h b/include/heap.h index de1f5f18..73be3ba6 100644 --- a/include/heap.h +++ b/include/heap.h @@ -2,22 +2,29 @@ #define POKEDIAMOND_HEAP_H #include "global.h" +#include "NNS_FND_expheap.h" + +struct UnkStruct_020EDB10 +{ + u32 size; + OSArenaId arena; +}; struct UnkStruct_020166C8 { - void **unk00; - void **unk04; + NNSFndHeapHandle *heapHandles; + NNSFndHeapHandle *unk04; void **unk08; u16 *unk0c; - u8 *unk10; - u16 unk14; - u16 unk16; + u8 *heapIdxs; + u16 totalNumHeaps; + u16 nTemplates; u16 unk18; u16 unk1a; }; -void FUN_020166C8(u32 *param0, u32 param1, u32 param2, u32 pre_size); +void FUN_020166C8(const struct UnkStruct_020EDB10 *templates, u32 nTemplates, u32 totalNumHeaps, u32 pre_size); s32 FUN_020167F4(); u32 FUN_0201681C(u32 param0, u32 heap_id, u32 param2); u32 FUN_02016828(u32 param0, u32 param1, u32 param2); diff --git a/include/unk_02016B94.h b/include/unk_02016B94.h index fec45cd8..7757b208 100644 --- a/include/unk_02016B94.h +++ b/include/unk_02016B94.h @@ -96,7 +96,7 @@ u32 FUN_02016BB8(u32 *param0); void FUN_02016BBC(const struct GraphicsModes *modes); void FUN_02016BF4(u32 *param0, u32 param1); void FUN_02016C18( - struct UnkStruct_02016B94_2 *param0, u8 param1, struct UnkStruct_02016B94_1 *param2, u8 param3); + struct UnkStruct_02016B94_2 *param0, u8 param1, const struct UnkStruct_02016B94_1 *param2, u8 param3); void FUN_020170F4(struct UnkStruct_02016B94_2 *param0, u8 param1, u32 param2, u8 param3); u8 FUN_020177DC(u8 param0, u32 param1); void FUN_02017850(u32 param0, u8 *param1, u8 *param2); @@ -264,7 +264,7 @@ void FUN_020190EC(struct UnkStruct_02016B94_2 *param0, u8 param5); void FUN_02019150(struct UnkStruct_02016B94_2 *param0, struct Window *param1, - struct UnkStruct_02016B94_4 *param2); + const struct UnkStruct_02016B94_4 *param2); void FUN_02019178(struct Window *param0); void FUN_020191A4(struct Window *param0, int param1); void CopyWindowToVram(struct Window *param0); -- cgit v1.2.3 From 2e6a113eb27577764b1b6de22e04ae1f73d3069f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 30 May 2021 09:19:03 -0400 Subject: Refactor heap.c, 2 --- include/heap.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/heap.h b/include/heap.h index 73be3ba6..3eb124ba 100644 --- a/include/heap.h +++ b/include/heap.h @@ -3,6 +3,7 @@ #include "global.h" #include "NNS_FND_expheap.h" +#include "NNS_FND_allocator.h" struct UnkStruct_020EDB10 { @@ -28,7 +29,7 @@ void FUN_020166C8(const struct UnkStruct_020EDB10 *templates, u32 nTemplates, u3 s32 FUN_020167F4(); u32 FUN_0201681C(u32 param0, u32 heap_id, u32 param2); u32 FUN_02016828(u32 param0, u32 param1, u32 param2); -u32 FUN_02016834(u32 param0, u32 param1, u32 param2, s32 param3); +u32 FUN_02016834(u32 param0, u32 param1, u32 size, s32 alignment); void FUN_020168D0(u32 heap_id); u32 *FUN_02016944(void *param0, u32 param1, s32 param2, u32 param3); void FUN_02016988(); @@ -36,9 +37,9 @@ void *AllocFromHeap(u32 heap_id, u32 size); void *AllocFromHeapAtEnd(u32 heap_id, u32 size); void FreeToHeap(void *ptr); void FreeToHeapExplicit(u32 heap_id, void * ptr); -u32 FUN_02016AF8(u32 param0); -void FUN_02016B20(u32 param0, u32 param1, u32 param2); -void FUN_02016B44(void *ptr, u32 param1); +u32 GF_ExpHeap_FndGetTotalFreeSize(u32 heap_id); +void GF_ExpHeap_FndInitAllocator(NNSFndAllocator * pAllocator, u32 heap_id, int alignment); +void ReallocFromHeap(void *ptr, u32 newSize); u32 FUN_02016B90(u32 param0); #endif //POKEDIAMOND_HEAP_H -- cgit v1.2.3 From daf02d9b198906d93a9b289315d0fc1e519843ef Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 30 May 2021 20:13:58 -0400 Subject: Document heap.c, 3 --- include/heap.h | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) (limited to 'include') diff --git a/include/heap.h b/include/heap.h index 3eb124ba..6910d4a6 100644 --- a/include/heap.h +++ b/include/heap.h @@ -11,28 +11,14 @@ struct UnkStruct_020EDB10 OSArenaId arena; }; -struct UnkStruct_020166C8 -{ - NNSFndHeapHandle *heapHandles; - NNSFndHeapHandle *unk04; - void **unk08; - u16 *unk0c; - u8 *heapIdxs; - u16 totalNumHeaps; - u16 nTemplates; - u16 unk18; - u16 unk1a; -}; - - -void FUN_020166C8(const struct UnkStruct_020EDB10 *templates, u32 nTemplates, u32 totalNumHeaps, u32 pre_size); -s32 FUN_020167F4(); -u32 FUN_0201681C(u32 param0, u32 heap_id, u32 param2); -u32 FUN_02016828(u32 param0, u32 param1, u32 param2); -u32 FUN_02016834(u32 param0, u32 param1, u32 size, s32 alignment); -void FUN_020168D0(u32 heap_id); -u32 *FUN_02016944(void *param0, u32 param1, s32 param2, u32 param3); -void FUN_02016988(); +void InitHeapSystem(const struct UnkStruct_020EDB10 *templates, u32 nTemplates, u32 totalNumHeaps, u32 pre_size); +s32 FindFirstAvailableHeapHandle(); +BOOL CreateHeap(u32 parent, u32 child, u32 size); +BOOL CreateHeapAtEnd(u32 parent, u32 child, u32 size); +BOOL CreateHeapInternal(u32 parent, u32 child, u32 size, s32 alignment); +void DestroyHeap(u32 heap_id); +void *AllocFromHeapInternal(NNSFndHeapHandle heap, u32 size, s32 alignment, u32 heap_id); +void AllocFail(); void *AllocFromHeap(u32 heap_id, u32 size); void *AllocFromHeapAtEnd(u32 heap_id, u32 size); void FreeToHeap(void *ptr); @@ -40,6 +26,6 @@ void FreeToHeapExplicit(u32 heap_id, void * ptr); u32 GF_ExpHeap_FndGetTotalFreeSize(u32 heap_id); void GF_ExpHeap_FndInitAllocator(NNSFndAllocator * pAllocator, u32 heap_id, int alignment); void ReallocFromHeap(void *ptr, u32 newSize); -u32 FUN_02016B90(u32 param0); +BOOL GF_heap_c_dummy_return_true(u32 heap_id); #endif //POKEDIAMOND_HEAP_H -- cgit v1.2.3 From 3b6540d8235fe2cdd62b8bd618ce424d3944a912 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 31 May 2021 08:27:32 -0400 Subject: Fix weird access in ReallocFromHeap --- include/heap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/heap.h b/include/heap.h index 6910d4a6..36c747a7 100644 --- a/include/heap.h +++ b/include/heap.h @@ -5,13 +5,13 @@ #include "NNS_FND_expheap.h" #include "NNS_FND_allocator.h" -struct UnkStruct_020EDB10 +struct HeapParam { u32 size; OSArenaId arena; }; -void InitHeapSystem(const struct UnkStruct_020EDB10 *templates, u32 nTemplates, u32 totalNumHeaps, u32 pre_size); +void InitHeapSystem(const struct HeapParam *templates, u32 nTemplates, u32 totalNumHeaps, u32 pre_size); s32 FindFirstAvailableHeapHandle(); BOOL CreateHeap(u32 parent, u32 child, u32 size); BOOL CreateHeapAtEnd(u32 parent, u32 child, u32 size); -- cgit v1.2.3 From d612c41066844fc82edaaea6bc946adbcc71a3d9 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 31 May 2021 12:14:52 -0400 Subject: Better docs of gx, error_message_reset, etc --- include/GX_layers.h | 9 +++++---- include/game_init.h | 2 +- include/unk_02016B94.h | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/GX_layers.h b/include/GX_layers.h index 3943d582..aca0154b 100644 --- a/include/GX_layers.h +++ b/include/GX_layers.h @@ -3,6 +3,7 @@ #include "global.h" +#include "gx.h" struct GX_LayerData { @@ -33,10 +34,10 @@ struct GraphicsBanks struct GraphicsModes { - u32 mode1; - u32 mode2; - u32 mode3; - u32 mode4; + GXDispMode dispMode; + GXBGMode bgMode; + GXBGMode subMode; + GXBG0As _2d3dMode; }; diff --git a/include/game_init.h b/include/game_init.h index 77484689..bf6569c4 100644 --- a/include/game_init.h +++ b/include/game_init.h @@ -27,7 +27,7 @@ void FUN_02016444(u8 a0); void FUN_02016454(u8 a0); void ReadKeypadAndTocuhpad(void); void ApplyButtonModeToInput(void); -void SetKeyRepeatTimers(int x, int y); +void SetKeyRepeatTimers(int continueDelay, int startDelay); void SetSoftResetDisableMask(u8 a0); void ClearSoftResetDisableMask(u8 a0); diff --git a/include/unk_02016B94.h b/include/unk_02016B94.h index 7757b208..d3648560 100644 --- a/include/unk_02016B94.h +++ b/include/unk_02016B94.h @@ -94,7 +94,7 @@ struct Window struct UnkStruct_02016B94_2 *FUN_02016B94(u32 heap_id); u32 FUN_02016BB8(u32 *param0); void FUN_02016BBC(const struct GraphicsModes *modes); -void FUN_02016BF4(u32 *param0, u32 param1); +void FUN_02016BF4(const struct GraphicsModes *param0, u32 param1); void FUN_02016C18( struct UnkStruct_02016B94_2 *param0, u8 param1, const struct UnkStruct_02016B94_1 *param2, u8 param3); void FUN_020170F4(struct UnkStruct_02016B94_2 *param0, u8 param1, u32 param2, u8 param3); -- cgit v1.2.3 From d9562dc1675e93f565e63eeba35369688bb70742 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 3 Jun 2021 08:52:12 -0400 Subject: Document window sys, 1 --- include/unk_02016B94.h | 75 +++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) (limited to 'include') diff --git a/include/unk_02016B94.h b/include/unk_02016B94.h index d3648560..788c8ddc 100644 --- a/include/unk_02016B94.h +++ b/include/unk_02016B94.h @@ -31,32 +31,33 @@ struct UnkStruct_02016B94_1 u32 unk18; }; -struct UnkStruct_02016B94_2 +struct UnkStruct_02016B94_2_sub { - u32 unk00; - u16 unk04; - u16 unk06; + void *unk08; + u32 unk0c; + u32 unk10; - struct UnkStruct_02016B94_2_sub - { - void *unk08; - u32 unk0c; - u32 unk10; + fx32 unk14; + fx32 unk18; - fx32 unk14; - fx32 unk18; + u8 mode; + u8 unk1d; + u8 unk1e; + u8 unk1f; + u16 unk20; + u16 unk22; // probably padding + fx32 unk24; + fx32 unk28; + fx32 unk2c; + fx32 unk30; +}; - u8 unk1c; - u8 unk1d; - u8 unk1e; - u8 unk1f; - u16 unk20; - u16 unk22; // probably padding - fx32 unk24; - fx32 unk28; - fx32 unk2c; - fx32 unk30; - } unk08[8]; +struct UnkStruct_02016B94_2 +{ + u32 heap_id; + u16 unk04; + u16 unk06; + struct UnkStruct_02016B94_2_sub unk08[8]; }; struct UnkStruct_02016B94_3 @@ -80,15 +81,15 @@ struct UnkStruct_02016B94_4 struct Window { struct UnkStruct_02016B94_2 *unk00; - u8 unk04; - u8 unk05; - u8 unk06; + u8 bgId; + u8 tilemapLeft; + u8 tilemapTop; u8 width; u8 height; - u8 unk09; - u16 unk0a_0 : 15; + u8 paletteNum; + u16 baseTile : 15; u16 unk0b_15 : 1; - void *unk0c; + void *pixelBuffer; }; struct UnkStruct_02016B94_2 *FUN_02016B94(u32 heap_id); @@ -265,15 +266,15 @@ void FUN_020190EC(struct UnkStruct_02016B94_2 *param0, void FUN_02019150(struct UnkStruct_02016B94_2 *param0, struct Window *param1, const struct UnkStruct_02016B94_4 *param2); -void FUN_02019178(struct Window *param0); -void FUN_020191A4(struct Window *param0, int param1); -void CopyWindowToVram(struct Window *param0); -void FUN_02019220(struct Window *param0); -void FUN_02019270(struct Window *param0); -void FUN_0201928C(struct Window *param0, u8 param1, u8 param2); -void FUN_020192B8(struct Window *param0); -void FUN_020192D4(struct Window *param0); -void FUN_02019358(struct Window *param0); +void FUN_02019178(struct Window *window); +void WindowArray_dtor(struct Window *windows, int count); +void CopyWindowToVram(struct Window *window); +void FUN_02019220(struct Window *window); +void PutWindowTilemap(struct Window *window); +void PutWindowTilemapRectAnchoredTopLeft(struct Window *window, u8 width, u8 height); +void FUN_020192B8(struct Window *window); +void PutWindowTilemap_TextMode(struct Window *param0); +void PutWindowTilemap_AffineMode(struct Window *param0); void FUN_020193B4(struct Window *param0); void FUN_02019444(struct Window *param0); void FUN_0201949C(struct Window *window); -- cgit v1.2.3 From 94eb56526428935ea1f49d2b8912b5b3022d99b7 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 3 Jun 2021 18:27:52 -0400 Subject: Rename window-related structs; port g2 reg inlines --- include/gf_gfx_loader.h | 4 +- include/script.h | 2 +- include/text_02054590.h | 4 +- include/unk_02016B94.h | 160 ++++++++++++++++++++++++------------------------ 4 files changed, 85 insertions(+), 85 deletions(-) (limited to 'include') diff --git a/include/gf_gfx_loader.h b/include/gf_gfx_loader.h index b95075dc..3f23d1ff 100644 --- a/include/gf_gfx_loader.h +++ b/include/gf_gfx_loader.h @@ -3,8 +3,8 @@ #include "unk_02016B94.h" -u32 GfGfxLoader_LoadCharData(NarcId narcId, s32 memberNo, struct UnkStruct_02016B94_2 * unkStruct02016B94_2, u32 a3, u32 a4, u32 szByte, BOOL isCompressed, u32 heap_id); -void GfGfxLoader_LoadScrnData(NarcId narcId, s32 memberNo, struct UnkStruct_02016B94_2 * unkStruct02016B94_2, u32 a3, u32 a4, u32 szByte, BOOL isCompressed, u32 heap_id); +u32 GfGfxLoader_LoadCharData(NarcId narcId, s32 memberNo, struct BgConfig * unkStruct02016B94_2, u32 a3, u32 a4, u32 szByte, BOOL isCompressed, u32 heap_id); +void GfGfxLoader_LoadScrnData(NarcId narcId, s32 memberNo, struct BgConfig * unkStruct02016B94_2, u32 a3, u32 a4, u32 szByte, BOOL isCompressed, u32 heap_id); void GfGfxLoader_GXLoadPal(NarcId narcId, s32 memberNo, u32 whichRoutine, u32 baseAddr, u32 szByte, u32 heap_id); void GfGfxLoader_GXLoadPalWithSrcOffset(NarcId narcId, s32 memberNo, u32 whichRoutine, u32 srcOffset, u32 baseAddr, u32 szByte, u32 heap_id); u32 GfGfxLoader_LoadWholePalette(NarcId narcId, s32 memberId, u32 whichRoutine, u32 baseAddr, u32 szByte, BOOL isCompressed, u32 heap_id); diff --git a/include/script.h b/include/script.h index 01bba305..2f5e6540 100644 --- a/include/script.h +++ b/include/script.h @@ -28,7 +28,7 @@ struct UnkStruct_02046444 struct UnkSavStruct80 { u8 padding[0x8]; - struct UnkStruct_02016B94_2 *unk08; + struct BgConfig *unk08; struct SaveBlock2 *saveBlock2; //0xC struct UnkStruct_0204639C *unk10; u8 padding2[0x8]; diff --git a/include/text_02054590.h b/include/text_02054590.h index 77170e70..eaffb2a0 100644 --- a/include/text_02054590.h +++ b/include/text_02054590.h @@ -8,13 +8,13 @@ void FUN_02054590(u32 param0, u32 param1); -void FUN_020545B8(struct UnkStruct_02016B94_2 *param0, struct Window *param1, u32 param2); +void FUN_020545B8(struct BgConfig *param0, struct Window *param1, u32 param2); void FUN_02054608(struct Window *param0, struct Options *options); void FUN_0205464C(struct Window *param0); u16 FUN_02054658(struct Window * window, struct String *str, struct Options *options, u8 param3); u16 DrawFieldMessage(struct Window * window, struct String *str, u8 fontId, u32 speed, u8 a4, u32 a5); u8 FUN_020546C8(u32 param0); -void FUN_020546E0(struct UnkStruct_02016B94_2 *param0, struct Window *param1, u32 param2, u32 param3); +void FUN_020546E0(struct BgConfig *param0, struct Window *param1, u32 param2, u32 param3); void FUN_02054744(struct Window *param0, u32 param1, u32 param2); #endif // POKEDIAMOND_UNK_02054590_H diff --git a/include/unk_02016B94.h b/include/unk_02016B94.h index 788c8ddc..d28a3f1e 100644 --- a/include/unk_02016B94.h +++ b/include/unk_02016B94.h @@ -31,7 +31,7 @@ struct UnkStruct_02016B94_1 u32 unk18; }; -struct UnkStruct_02016B94_2_sub +struct Bg { void *unk08; u32 unk0c; @@ -43,7 +43,7 @@ struct UnkStruct_02016B94_2_sub u8 mode; u8 unk1d; u8 unk1e; - u8 unk1f; + u8 tileSize; u16 unk20; u16 unk22; // probably padding fx32 unk24; @@ -52,12 +52,12 @@ struct UnkStruct_02016B94_2_sub fx32 unk30; }; -struct UnkStruct_02016B94_2 +struct BgConfig { u32 heap_id; u16 unk04; u16 unk06; - struct UnkStruct_02016B94_2_sub unk08[8]; + struct Bg bgs[8]; }; struct UnkStruct_02016B94_3 @@ -67,20 +67,20 @@ struct UnkStruct_02016B94_3 u16 unk06; }; -struct UnkStruct_02016B94_4 +struct WindowTemplate { - u8 unk0; - u8 unk1; - u8 unk2; - u8 unk3; - u8 unk4; - u8 unk5; - u16 unk6; + u8 bgId; + u8 tilemapLeft; + u8 tilemapTop; + u8 width; + u8 height; + u8 paletteNum; + u16 baseTile; }; struct Window { - struct UnkStruct_02016B94_2 *unk00; + struct BgConfig *bgConfig; u8 bgId; u8 tilemapLeft; u8 tilemapTop; @@ -92,61 +92,61 @@ struct Window void *pixelBuffer; }; -struct UnkStruct_02016B94_2 *FUN_02016B94(u32 heap_id); +struct BgConfig *FUN_02016B94(u32 heap_id); u32 FUN_02016BB8(u32 *param0); void FUN_02016BBC(const struct GraphicsModes *modes); void FUN_02016BF4(const struct GraphicsModes *param0, u32 param1); void FUN_02016C18( - struct UnkStruct_02016B94_2 *param0, u8 param1, const struct UnkStruct_02016B94_1 *param2, u8 param3); -void FUN_020170F4(struct UnkStruct_02016B94_2 *param0, u8 param1, u32 param2, u8 param3); + struct BgConfig *param0, u8 param1, const struct UnkStruct_02016B94_1 *param2, u8 param3); +void FUN_020170F4(struct BgConfig *param0, u8 param1, u32 param2, u8 param3); u8 FUN_020177DC(u8 param0, u32 param1); void FUN_02017850(u32 param0, u8 *param1, u8 *param2); -void FUN_020178A0(struct UnkStruct_02016B94_2 *param0, u32 param1); +void FUN_020178A0(struct BgConfig *param0, u32 param1); void FUN_020178BC(u32 param0, u16 param1); void FUN_0201797C(u32 param0, GX_LayerToggle toggle); -void FUN_020179E0(struct UnkStruct_02016B94_2 *param0, u32 param1, u32 param2, fx32 val); -fx32 FUN_02017B48(struct UnkStruct_02016B94_2 *param0, u32 param1); -fx32 FUN_02017B54(struct UnkStruct_02016B94_2 *param0, u32 param1); -void FUN_02017B60(struct UnkStruct_02016B94_2 *param0, +void FUN_020179E0(struct BgConfig *param0, u32 param1, u32 param2, fx32 val); +fx32 FUN_02017B48(struct BgConfig *param0, u32 param1); +fx32 FUN_02017B54(struct BgConfig *param0, u32 param1); +void FUN_02017B60(struct BgConfig *param0, u32 param1, u32 param2, fx32 param3, struct Mtx22 *param4, fx32 param5, fx32 param6); -void FUN_02017B8C(struct UnkStruct_02016B94_2_sub *param0, u32 param1, fx32 val); -void FUN_02017BD0(struct UnkStruct_02016B94_2 *param0, +void FUN_02017B8C(struct Bg *param0, u32 param1, fx32 val); +void FUN_02017BD0(struct BgConfig *param0, u32 param1, struct Mtx22 *param2, fx32 param3, fx32 param4); -void FUN_02017C6C(struct UnkStruct_02016B94_2 *param0, u32 param1); +void FUN_02017C6C(struct BgConfig *param0, u32 param1); void FUN_02017C98(const void *param0, void *param1, u32 param2); -void FUN_02017CD0(struct UnkStruct_02016B94_2 *param0, u32 param1); +void FUN_02017CD0(struct BgConfig *param0, u32 param1); void FUN_02017CE8( - struct UnkStruct_02016B94_2 *param0, u32 param1, u32 *param2, u32 param3, u32 param4); + struct BgConfig *param0, u32 param1, u32 *param2, u32 param3, u32 param4); void FUN_02017D68(u32 param0, void *param1, u32 offset, u32 size); -void FUN_02017DFC(struct UnkStruct_02016B94_2 *param0, u32 param1, void *param2, u32 param3); +void FUN_02017DFC(struct BgConfig *param0, u32 param1, void *param2, u32 param3); void FUN_02017E14( - struct UnkStruct_02016B94_2 *param0, u32 param1, u32 *param2, u32 param3, u32 param4); + struct BgConfig *param0, u32 param1, u32 *param2, u32 param3, u32 param4); void FUN_02017E40( - struct UnkStruct_02016B94_2 *param0, u32 param1, u32 *param2, u32 param3, u32 param4); + struct BgConfig *param0, u32 param1, u32 *param2, u32 param3, u32 param4); void FUN_02017E84(u32 param0, void *param1, u32 offset, u32 size); void FUN_02017F18(u32 param0, u32 size, u32 offset, u32 heap_id); void FUN_02017F48( - struct UnkStruct_02016B94_2 *param0, u32 param1, u32 param2, u32 param3, u32 param4); + struct BgConfig *param0, u32 param1, u32 param2, u32 param3, u32 param4); void FUN_02017FB4(u32 param0, void *param1, u32 offset, u32 size); void FUN_02017FE4(u32 param0, u32 param1); u16 FUN_02017FFC(u8 param0, u8 param1, u8 param2); u16 FUN_02018068(u8 param0, u8 param1, u8 param2, u8 param3); -void FUN_02018148(struct UnkStruct_02016B94_2 *param0, +void FUN_02018148(struct BgConfig *param0, u32 param1, void *param2, u8 param3, u8 param4, u8 param5, u8 param6); -void FUN_02018170(struct UnkStruct_02016B94_2 *param0, +void FUN_02018170(struct BgConfig *param0, u32 param1, u8 param2, u8 param3, @@ -157,7 +157,7 @@ void FUN_02018170(struct UnkStruct_02016B94_2 *param0, u8 param8, u8 param9, u8 param10); -void FUN_020181EC(struct UnkStruct_02016B94_2 *param0, +void FUN_020181EC(struct BgConfig *param0, u32 param1, u8 param2, u8 param3, @@ -168,7 +168,7 @@ void FUN_020181EC(struct UnkStruct_02016B94_2 *param0, u8 param8, u8 param9, u8 param10); -void FUN_02018268(struct UnkStruct_02016B94_2_sub *param0, +void FUN_02018268(struct Bg *param0, u8 param1, u8 param2, u8 param3, @@ -179,7 +179,7 @@ void FUN_02018268(struct UnkStruct_02016B94_2_sub *param0, u8 param8, u8 param9, u8 param10); -void FUN_020183DC(struct UnkStruct_02016B94_2_sub *param0, +void FUN_020183DC(struct Bg *param0, u8 param1, u8 param2, u8 param3, @@ -190,7 +190,7 @@ void FUN_020183DC(struct UnkStruct_02016B94_2_sub *param0, u8 param8, u8 param9, u8 param10); -void FUN_02018540(struct UnkStruct_02016B94_2 *param0, +void FUN_02018540(struct BgConfig *param0, u32 param1, u16 param2, u8 param3, @@ -198,7 +198,7 @@ void FUN_02018540(struct UnkStruct_02016B94_2 *param0, u8 param5, u8 param6, u8 param7); -void FUN_02018590(struct UnkStruct_02016B94_2_sub *param0, +void FUN_02018590(struct Bg *param0, u16 param1, u8 param2, u8 param3, @@ -206,23 +206,23 @@ void FUN_02018590(struct UnkStruct_02016B94_2_sub *param0, u8 param5, u8 param6); void FUN_02018640( - struct UnkStruct_02016B94_2_sub *param0, u8 param1, u8 param2, u8 param3, u8 param4, u8 param5); -void FUN_020186B4(struct UnkStruct_02016B94_2 *param0, + struct Bg *param0, u8 param1, u8 param2, u8 param3, u8 param4, u8 param5); +void FUN_020186B4(struct BgConfig *param0, u32 param1, u8 param2, u8 param3, u8 param4, u8 param5, u8 param6); -void FUN_02018744(struct UnkStruct_02016B94_2 *param0, u32 param1); -void FUN_02018768(struct UnkStruct_02016B94_2 *param0, u32 param1, u16 param2); -void FUN_0201878C(struct UnkStruct_02016B94_2 *param0, u32 param1, u16 param2); +void FUN_02018744(struct BgConfig *param0, u32 param1); +void FUN_02018768(struct BgConfig *param0, u32 param1, u16 param2); +void FUN_0201878C(struct BgConfig *param0, u32 param1, u16 param2); void *FUN_020187B0(u32 param0); void FUN_02018808(u8 *param0, u32 param1, u8 (*param2)[2], u8 param3); u8 (*FUN_02018848(u8 *param0, u32 param1, u8 param2, u32 heap_id))[2]; -void *FUN_0201886C(struct UnkStruct_02016B94_2 *param0, u8 param1); -u16 FUN_02018878(struct UnkStruct_02016B94_2 *param0, u32 param1); -u8 FUN_02018884(struct UnkStruct_02016B94_2 *param0, u32 param1); +void *FUN_0201886C(struct BgConfig *param0, u8 param1); +u16 FUN_02018878(struct BgConfig *param0, u32 param1); +u8 FUN_02018884(struct BgConfig *param0, u32 param1); void BlitBitmapRect4Bit(struct UnkStruct_02016B94_3 *param0, struct UnkStruct_02016B94_3 *param1, u16 param2, @@ -245,28 +245,28 @@ void FUN_02018E88( struct UnkStruct_02016B94_3 *param0, u16 param1, u16 param2, u16 param3, u16 param4, u8 param5); void FUN_02018F4C( struct UnkStruct_02016B94_3 *param0, u16 param1, u16 param2, u16 param3, u16 param4, u8 param5); -void *AllocWindows(u32 heap_id, s32 size); -void InitWindow(struct Window *param0); -BOOL FUN_02019048(struct Window *param0); -void FUN_02019064(struct UnkStruct_02016B94_2 *param0, - struct Window *param1, - u8 param2, - u8 param3, - u8 param4, - u8 param5, - u8 param6, - u8 param7, - u16 param8); -void FUN_020190EC(struct UnkStruct_02016B94_2 *param0, - struct Window *param1, - u8 param2, - u8 param3, - u16 param4, - u8 param5); -void FUN_02019150(struct UnkStruct_02016B94_2 *param0, - struct Window *param1, - const struct UnkStruct_02016B94_4 *param2); -void FUN_02019178(struct Window *window); +struct Window *AllocWindows(u32 heap_id, s32 size); +void InitWindow(struct Window *window); +BOOL WindowIsInUse(struct Window *window); +void AddWindowParameterized(struct BgConfig *param0, + struct Window *window, + u8 bgId, + u8 tilemapLeft, + u8 tilemapTop, + u8 width, + u8 height, + u8 paletteNum, + u16 baseTile); +void AddTextWindowTopLeftCorner(struct BgConfig *param0, + struct Window *window, + u8 width, + u8 height, + u16 baseTile, + u8 paletteNum); +void AddWindow(struct BgConfig *bgConfig, + struct Window *window, + const struct WindowTemplate *template); +void RemoveWindow(struct Window *window); void WindowArray_dtor(struct Window *windows, int count); void CopyWindowToVram(struct Window *window); void FUN_02019220(struct Window *window); @@ -277,9 +277,9 @@ void PutWindowTilemap_TextMode(struct Window *param0); void PutWindowTilemap_AffineMode(struct Window *param0); void FUN_020193B4(struct Window *param0); void FUN_02019444(struct Window *param0); -void FUN_0201949C(struct Window *window); +void CopyWindowToVram_TextMode(struct Window *window); void FUN_020194C8(struct Window *window); -void FUN_020194E0(struct Window *window); +void CopyWindowToVram_AffineMode(struct Window *window); void FUN_0201951C(struct Window *window); void FUN_02019548(struct Window *window); void FUN_02019570(struct Window *window); @@ -326,16 +326,16 @@ void FUN_0201AB20(struct Window *window, u8 param1); void FUN_0201AB24(struct Window *window, u8 param1); u32 FUN_0201AB28(struct Window *window, u32 heap_id, const char *path); u32 FUN_0201AB44(struct Window *window, u32 heap_id, const char *path); -void FUN_0201AB60(struct UnkStruct_02016B94_2 *param0); -void FUN_0201AB78(struct UnkStruct_02016B94_2 *param0); -void FUN_0201AC68(struct UnkStruct_02016B94_2 *param0, u32 param1); -void FUN_0201AC78(struct UnkStruct_02016B94_2 *param0); -void FUN_0201AEE4(struct UnkStruct_02016B94_2 *param0, u32 param1, u32 param2, fx32 param3); -void FUN_0201AF08(struct UnkStruct_02016B94_2 *param0, u32 param1, u32 param2, u16 param3); -void FUN_0201AF2C(struct UnkStruct_02016B94_2_sub *param0, u32 param1, u16 val); -void FUN_0201AF50(struct UnkStruct_02016B94_2 *param0, u32 param1, u32 param2, fx32 param3); -void FUN_0201AF74(struct UnkStruct_02016B94_2_sub *param0, u32 param1, fx32 val); -u32 FUN_0201AFBC(struct UnkStruct_02016B94_2 *param0, u8 param1, u8 param2, u8 param3, u16 *param4); -void FUN_0201B118(struct UnkStruct_02016B94_2 *param0, u8 param1, u8 *param2); +void FUN_0201AB60(struct BgConfig *param0); +void FUN_0201AB78(struct BgConfig *param0); +void FUN_0201AC68(struct BgConfig *param0, u32 param1); +void FUN_0201AC78(struct BgConfig *param0); +void FUN_0201AEE4(struct BgConfig *param0, u32 param1, u32 param2, fx32 param3); +void FUN_0201AF08(struct BgConfig *param0, u32 param1, u32 param2, u16 param3); +void FUN_0201AF2C(struct Bg *param0, u32 param1, u16 val); +void FUN_0201AF50(struct BgConfig *param0, u32 param1, u32 param2, fx32 param3); +void FUN_0201AF74(struct Bg *param0, u32 param1, fx32 val); +u32 FUN_0201AFBC(struct BgConfig *param0, u8 param1, u8 param2, u8 param3, u16 *param4); +void FUN_0201B118(struct BgConfig *param0, u8 param1, u8 *param2); #endif // POKEDIAMOND_UNK_02016B94_H -- cgit v1.2.3 From 662866c1e3ed69c3895c5794ef6c9ab9cf9c1f0a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 3 Jun 2021 18:59:46 -0400 Subject: Match FUN_02016C18 --- include/unk_02016B94.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/unk_02016B94.h b/include/unk_02016B94.h index d28a3f1e..1c86fafd 100644 --- a/include/unk_02016B94.h +++ b/include/unk_02016B94.h @@ -13,7 +13,7 @@ #define reg_G2_BG3P (u32 *)0x4000030 #define reg_G2S_DB_BG2P (u32 *)0x4001020 #define reg_G2S_DB_BG3P (u32 *)0x4001030 -struct UnkStruct_02016B94_1 +struct BgTemplate { u32 unk00; u32 unk04; @@ -21,14 +21,14 @@ struct UnkStruct_02016B94_1 u32 unk0c; u8 unk10; - u8 unk11; - u8 unk12; - u8 unk13; - u8 unk14; - u8 unk15; - u8 unk16; + u8 colorMode; + u8 screenBase; + u8 charBase; + u8 bgExtPltt; + u8 priority; + u8 areaOver; u8 unk17; // probably paddding - u32 unk18; + u32 mosaic; }; struct Bg @@ -97,7 +97,7 @@ u32 FUN_02016BB8(u32 *param0); void FUN_02016BBC(const struct GraphicsModes *modes); void FUN_02016BF4(const struct GraphicsModes *param0, u32 param1); void FUN_02016C18( - struct BgConfig *param0, u8 param1, const struct UnkStruct_02016B94_1 *param2, u8 param3); + struct BgConfig *param0, u8 param1, const struct BgTemplate *param2, u8 param3); void FUN_020170F4(struct BgConfig *param0, u8 param1, u32 param2, u8 param3); u8 FUN_020177DC(u8 param0, u32 param1); void FUN_02017850(u32 param0, u8 *param1, u8 *param2); -- cgit v1.2.3 From 1302b621f1da88e4db66e301f6beade6554ca3e8 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 3 Jun 2021 20:30:32 -0400 Subject: Match FUN_02018884 --- include/unk_02016B94.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/unk_02016B94.h b/include/unk_02016B94.h index 1c86fafd..9b9afeb5 100644 --- a/include/unk_02016B94.h +++ b/include/unk_02016B94.h @@ -17,7 +17,7 @@ struct BgTemplate { u32 unk00; u32 unk04; - u32 unk08; + u32 bufferSize; u32 unk0c; u8 unk10; @@ -33,7 +33,7 @@ struct BgTemplate struct Bg { - void *unk08; + void *tilemapBuffer; u32 unk0c; u32 unk10; @@ -42,7 +42,7 @@ struct Bg u8 mode; u8 unk1d; - u8 unk1e; + u8 colorMode; u8 tileSize; u16 unk20; u16 unk22; // probably padding @@ -97,8 +97,8 @@ u32 FUN_02016BB8(u32 *param0); void FUN_02016BBC(const struct GraphicsModes *modes); void FUN_02016BF4(const struct GraphicsModes *param0, u32 param1); void FUN_02016C18( - struct BgConfig *param0, u8 param1, const struct BgTemplate *param2, u8 param3); -void FUN_020170F4(struct BgConfig *param0, u8 param1, u32 param2, u8 param3); + struct BgConfig *param0, u8 param1, const struct BgTemplate *template, u8 bgMode); +void FUN_020170F4(struct BgConfig *config, u8 bgId, u32 attr, u8 value); u8 FUN_020177DC(u8 param0, u32 param1); void FUN_02017850(u32 param0, u8 *param1, u8 *param2); void FUN_020178A0(struct BgConfig *param0, u32 param1); -- cgit v1.2.3 From 90a0a6057ca82df771648cf3b49bb80da587a060 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 4 Jun 2021 17:29:30 -0400 Subject: Match BlitBitmapRect4Bit --- include/unk_02016B94.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/unk_02016B94.h b/include/unk_02016B94.h index 9b9afeb5..80c3d18c 100644 --- a/include/unk_02016B94.h +++ b/include/unk_02016B94.h @@ -60,11 +60,11 @@ struct BgConfig struct Bg bgs[8]; }; -struct UnkStruct_02016B94_3 +struct Bitmap { - void *unk00; - u16 unk04; - u16 unk06; + const u8 *pixels; + u16 width; + u16 height; }; struct WindowTemplate @@ -223,17 +223,17 @@ u8 (*FUN_02018848(u8 *param0, u32 param1, u8 param2, u32 heap_id))[2]; void *FUN_0201886C(struct BgConfig *param0, u8 param1); u16 FUN_02018878(struct BgConfig *param0, u32 param1); u8 FUN_02018884(struct BgConfig *param0, u32 param1); -void BlitBitmapRect4Bit(struct UnkStruct_02016B94_3 *param0, - struct UnkStruct_02016B94_3 *param1, - u16 param2, - u16 param3, - u16 param4, - u16 param5, - u16 param6, - u16 param7, - u16 param8); -void BlitBitmapRect8Bit(struct UnkStruct_02016B94_3 *param0, - struct UnkStruct_02016B94_3 *param1, +void BlitBitmapRect4Bit(const struct Bitmap *src, + const struct Bitmap *dst, + u16 srcX, + u16 srcY, + u16 dstX, + u16 dstY, + u16 width, + u16 height, + u16 colorKey); +void BlitBitmapRect8Bit(struct Bitmap *param0, + struct Bitmap *param1, u16 param2, u16 param3, u16 param4, @@ -242,9 +242,9 @@ void BlitBitmapRect8Bit(struct UnkStruct_02016B94_3 *param0, u16 param7, u16 param8); void FUN_02018E88( - struct UnkStruct_02016B94_3 *param0, u16 param1, u16 param2, u16 param3, u16 param4, u8 param5); + struct Bitmap *param0, u16 param1, u16 param2, u16 param3, u16 param4, u8 param5); void FUN_02018F4C( - struct UnkStruct_02016B94_3 *param0, u16 param1, u16 param2, u16 param3, u16 param4, u8 param5); + struct Bitmap *param0, u16 param1, u16 param2, u16 param3, u16 param4, u8 param5); struct Window *AllocWindows(u32 heap_id, s32 size); void InitWindow(struct Window *window); BOOL WindowIsInUse(struct Window *window); -- cgit v1.2.3 From 1b5cf67f5f3585ea1a50dc2d487e6897dd7e6f55 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 4 Jun 2021 17:34:18 -0400 Subject: Match BlitBitmapRect8Bit --- include/unk_02016B94.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/unk_02016B94.h b/include/unk_02016B94.h index 80c3d18c..475626bf 100644 --- a/include/unk_02016B94.h +++ b/include/unk_02016B94.h @@ -232,15 +232,15 @@ void BlitBitmapRect4Bit(const struct Bitmap *src, u16 width, u16 height, u16 colorKey); -void BlitBitmapRect8Bit(struct Bitmap *param0, - struct Bitmap *param1, - u16 param2, - u16 param3, - u16 param4, - u16 param5, - u16 param6, - u16 param7, - u16 param8); +void BlitBitmapRect8Bit(const struct Bitmap *src, + const struct Bitmap *dst, + u16 srcX, + u16 srcY, + u16 dstX, + u16 dstY, + u16 width, + u16 height, + u16 colorKey); void FUN_02018E88( struct Bitmap *param0, u16 param1, u16 param2, u16 param3, u16 param4, u8 param5); void FUN_02018F4C( -- cgit v1.2.3 From e29c9e21ba9b64c86ac677b2bf4a69e92e8ac34b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 4 Jun 2021 18:37:08 -0400 Subject: Port more inlines from gx lib --- include/unk_02016B94.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'include') diff --git a/include/unk_02016B94.h b/include/unk_02016B94.h index 475626bf..1e5a4fdb 100644 --- a/include/unk_02016B94.h +++ b/include/unk_02016B94.h @@ -34,28 +34,28 @@ struct BgTemplate struct Bg { void *tilemapBuffer; - u32 unk0c; + u32 bufferSize; u32 unk10; - fx32 unk14; - fx32 unk18; + fx32 hOffset; + fx32 vOffset; u8 mode; u8 unk1d; u8 colorMode; u8 tileSize; - u16 unk20; + u16 rotation; u16 unk22; // probably padding - fx32 unk24; - fx32 unk28; - fx32 unk2c; - fx32 unk30; + fx32 xScale; + fx32 yScale; + fx32 centerX; + fx32 centerY; }; struct BgConfig { u32 heap_id; - u16 unk04; + u16 scrollScheduled; u16 unk06; struct Bg bgs[8]; }; @@ -101,10 +101,10 @@ void FUN_02016C18( void FUN_020170F4(struct BgConfig *config, u8 bgId, u32 attr, u8 value); u8 FUN_020177DC(u8 param0, u32 param1); void FUN_02017850(u32 param0, u8 *param1, u8 *param2); -void FUN_020178A0(struct BgConfig *param0, u32 param1); -void FUN_020178BC(u32 param0, u16 param1); -void FUN_0201797C(u32 param0, GX_LayerToggle toggle); -void FUN_020179E0(struct BgConfig *param0, u32 param1, u32 param2, fx32 val); +void FUN_020178A0(struct BgConfig *bgConfig, u32 bgId); +void FUN_020178BC(u32 bgId, u16 priority); +void ToggleBgLayer(u32 bgId, GX_LayerToggle toggle); +void FUN_020179E0(struct BgConfig *bgConfig, u32 bgId, u32 param2, fx32 val); fx32 FUN_02017B48(struct BgConfig *param0, u32 param1); fx32 FUN_02017B54(struct BgConfig *param0, u32 param1); void FUN_02017B60(struct BgConfig *param0, @@ -220,9 +220,9 @@ void FUN_0201878C(struct BgConfig *param0, u32 param1, u16 param2); void *FUN_020187B0(u32 param0); void FUN_02018808(u8 *param0, u32 param1, u8 (*param2)[2], u8 param3); u8 (*FUN_02018848(u8 *param0, u32 param1, u8 param2, u32 heap_id))[2]; -void *FUN_0201886C(struct BgConfig *param0, u8 param1); +void *GetBgTilemapBuffer(struct BgConfig *bgConfig, u8 bgId); u16 FUN_02018878(struct BgConfig *param0, u32 param1); -u8 FUN_02018884(struct BgConfig *param0, u32 param1); +u8 GetBgPriority(struct BgConfig *bgConfig, u32 bgId); void BlitBitmapRect4Bit(const struct Bitmap *src, const struct Bitmap *dst, u16 srcX, @@ -241,10 +241,10 @@ void BlitBitmapRect8Bit(const struct Bitmap *src, u16 width, u16 height, u16 colorKey); -void FUN_02018E88( - struct Bitmap *param0, u16 param1, u16 param2, u16 param3, u16 param4, u8 param5); -void FUN_02018F4C( - struct Bitmap *param0, u16 param1, u16 param2, u16 param3, u16 param4, u8 param5); +void FillBitmapRect4Bit( + struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); +void FillBitmapRect8Bit( + struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); struct Window *AllocWindows(u32 heap_id, s32 size); void InitWindow(struct Window *window); BOOL WindowIsInUse(struct Window *window); -- cgit v1.2.3 From ae369d76f0415f105020c6084fc1a6687c86407c Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 4 Jun 2021 20:43:31 -0400 Subject: Rename more bg and window routines --- include/unk_02016B94.h | 97 ++++++++++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 50 deletions(-) (limited to 'include') diff --git a/include/unk_02016B94.h b/include/unk_02016B94.h index 1e5a4fdb..9479f889 100644 --- a/include/unk_02016B94.h +++ b/include/unk_02016B94.h @@ -1,6 +1,7 @@ #ifndef POKEDIAMOND_UNK_02016B94_H #define POKEDIAMOND_UNK_02016B94_H +#include "NNS_g2d.h" #include "global.h" #include "GX_layers.h" #include "MI_uncompress.h" @@ -9,10 +10,6 @@ #include "heap.h" #include "math_util.h" -#define reg_G2_BG2P (u32 *)0x4000020 -#define reg_G2_BG3P (u32 *)0x4000030 -#define reg_G2S_DB_BG2P (u32 *)0x4001020 -#define reg_G2S_DB_BG3P (u32 *)0x4001030 struct BgTemplate { u32 unk00; @@ -56,7 +53,7 @@ struct BgConfig { u32 heap_id; u16 scrollScheduled; - u16 unk06; + u16 bufferTransferScheduled; struct Bg bgs[8]; }; @@ -100,7 +97,7 @@ void FUN_02016C18( struct BgConfig *param0, u8 param1, const struct BgTemplate *template, u8 bgMode); void FUN_020170F4(struct BgConfig *config, u8 bgId, u32 attr, u8 value); u8 FUN_020177DC(u8 param0, u32 param1); -void FUN_02017850(u32 param0, u8 *param1, u8 *param2); +void GetBgScreenDimensions(u32 screenSize, u8 *width_p, u8 *height_p); void FUN_020178A0(struct BgConfig *bgConfig, u32 bgId); void FUN_020178BC(u32 bgId, u16 priority); void ToggleBgLayer(u32 bgId, GX_LayerToggle toggle); @@ -114,7 +111,7 @@ void FUN_02017B60(struct BgConfig *param0, struct Mtx22 *param4, fx32 param5, fx32 param6); -void FUN_02017B8C(struct Bg *param0, u32 param1, fx32 val); +void Bg_SetPosText(struct Bg *bg, u32 op, fx32 val); void FUN_02017BD0(struct BgConfig *param0, u32 param1, struct Mtx22 *param2, @@ -125,20 +122,20 @@ void FUN_02017C98(const void *param0, void *param1, u32 param2); void FUN_02017CD0(struct BgConfig *param0, u32 param1); void FUN_02017CE8( struct BgConfig *param0, u32 param1, u32 *param2, u32 param3, u32 param4); -void FUN_02017D68(u32 param0, void *param1, u32 offset, u32 size); +void LoadBgVramScr(u32 bgId, void *buffer_p, u32 offset, u32 size); void FUN_02017DFC(struct BgConfig *param0, u32 param1, void *param2, u32 param3); -void FUN_02017E14( - struct BgConfig *param0, u32 param1, u32 *param2, u32 param3, u32 param4); -void FUN_02017E40( - struct BgConfig *param0, u32 param1, u32 *param2, u32 param3, u32 param4); -void FUN_02017E84(u32 param0, void *param1, u32 offset, u32 size); -void FUN_02017F18(u32 param0, u32 size, u32 offset, u32 heap_id); -void FUN_02017F48( - struct BgConfig *param0, u32 param1, u32 param2, u32 param3, u32 param4); -void FUN_02017FB4(u32 param0, void *param1, u32 offset, u32 size); -void FUN_02017FE4(u32 param0, u32 param1); -u16 FUN_02017FFC(u8 param0, u8 param1, u8 param2); -u16 FUN_02018068(u8 param0, u8 param1, u8 param2, u8 param3); +void BG_LoadCharTilesData( + struct BgConfig *bgConfig, u32 bgId, u32 *charData, u32 offset, u32 numTiles); +void BG_LoadCharPixelData( + struct BgConfig *bgConfig, u32 bgId, u32 *charData, u32 size, u32 offset); +void LoadBgVramChar(u32 bgId, void *buffer_p, u32 offset, u32 size); +void BG_ClearCharDataRange(u32 bgId, u32 size, u32 offset, u32 heap_id); +void BG_FillCharDataRange( + struct BgConfig *param0, u32 bgId, u32 fillValue, u32 count, u32 offset); +void BG_LoadPlttData(u32 bgId, void *plttData, u32 size, u32 offset); +void BG_SetMaskColor(u32 bgId, u32 value); +u16 GetTileMapIndexFromCoords(u8 x, u8 y, u8 screenSize); +u16 GetSrcTileMapIndexFromCoords(u8 x, u8 y, u8 width, u8 height); void FUN_02018148(struct BgConfig *param0, u32 param1, void *param2, @@ -168,16 +165,16 @@ void FUN_020181EC(struct BgConfig *param0, u8 param8, u8 param9, u8 param10); -void FUN_02018268(struct Bg *param0, - u8 param1, - u8 param2, - u8 param3, - u8 param4, - u16 *param5, - u8 param6, - u8 param7, - u8 param8, - u8 param9, +void FUN_02018268(struct Bg *bg, + u8 dstX, + u8 dstY, + u8 width, + u8 height, + u16 *src, + u8 srcX, + u8 srcY, + u8 srcWidth, + u8 srcHeight, u8 param10); void FUN_020183DC(struct Bg *param0, u8 param1, @@ -314,28 +311,28 @@ void FillWindowPixelRect(struct Window *window, u8 fillValue, u16 x, u16 y, u16 void FUN_0201974C( struct Window *window, u32 *param1, u32 param2, u32 param3, u16 param4, u16 param5, u32 param6); void ScrollWindow(struct Window *window, u32 param1, u8 param2, u8 param3); -void FUN_0201A8E8(struct Window *window, u32 param1, u8 param2, u8 param3); -void FUN_0201A9D4(struct Window *window, u32 param1, u8 param2, u8 param3); -u8 FUN_0201AB08(struct Window *window); +void ScrollWindow4bpp(struct Window *window, u32 param1, u8 param2, u8 fillValue); +void ScrollWindow8bpp(struct Window *window, u32 param1, u8 param2, u8 fillValue); +u8 GetWindowBgId(struct Window *window); u8 GetWindowWidth(struct Window *window); u8 GetWindowHeight(struct Window *window); -u8 FUN_0201AB14(struct Window *window); -u8 FUN_0201AB18(struct Window *window); -void FUN_0201AB1C(struct Window *window, u8 param1); -void FUN_0201AB20(struct Window *window, u8 param1); -void FUN_0201AB24(struct Window *window, u8 param1); -u32 FUN_0201AB28(struct Window *window, u32 heap_id, const char *path); -u32 FUN_0201AB44(struct Window *window, u32 heap_id, const char *path); -void FUN_0201AB60(struct BgConfig *param0); -void FUN_0201AB78(struct BgConfig *param0); -void FUN_0201AC68(struct BgConfig *param0, u32 param1); -void FUN_0201AC78(struct BgConfig *param0); -void FUN_0201AEE4(struct BgConfig *param0, u32 param1, u32 param2, fx32 param3); -void FUN_0201AF08(struct BgConfig *param0, u32 param1, u32 param2, u16 param3); -void FUN_0201AF2C(struct Bg *param0, u32 param1, u16 val); -void FUN_0201AF50(struct BgConfig *param0, u32 param1, u32 param2, fx32 param3); -void FUN_0201AF74(struct Bg *param0, u32 param1, fx32 val); -u32 FUN_0201AFBC(struct BgConfig *param0, u8 param1, u8 param2, u8 param3, u16 *param4); +u8 GetWindowX(struct Window *window); +u8 GetWindowY(struct Window *window); +void MoveWindowX(struct Window *window, u8 x); +void MoveWindowY(struct Window *window, u8 y); +void SetWindowPaletteNum(struct Window *window, u8 paletteNum); +NNSG2dCharacterData * LoadCharacterDataFromFile(void **char_ret, u32 heap_id, const char *path); +NNSG2dPaletteData * LoadPaletteDataFromFile(void **pltt_ret, u32 heap_id, const char *path); +void DoScheduledBgGpuUpdates(struct BgConfig *bgConfig); +void DoScheduledBgTilemapBufferTransfers(struct BgConfig *bgConfig); +void ScheduleBgTilemapBufferTransfer(struct BgConfig *bgConfig, u32 bgId); +void ApplyScheduledBgPosUpdate(struct BgConfig *bgConfig); +void ScheduleSetBgPosText(struct BgConfig *bgConfig, u32 bgId, u32 op, fx32 value); +void ScheduleSetBgAffineRotation(struct BgConfig *bgConfig, u32 bgId, u32 op, u16 value); +void Bg_SetAffineRotation(struct Bg *bg, u32 op, u16 val); +void ScheduleSetBgAffinePos(struct BgConfig *bgConfig, u32 bgId, u32 op, fx32 value); +void Bg_SetAffinePos(struct Bg *bg, u32 op, fx32 val); +u32 FUN_0201AFBC(struct BgConfig *bgConfig, u8 bgId, u8 x, u8 y, u16 *src); void FUN_0201B118(struct BgConfig *param0, u8 param1, u8 *param2); #endif // POKEDIAMOND_UNK_02016B94_H -- cgit v1.2.3 From cc45732d6b7acab3dd1fc533064206dd11b32ce6 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 5 Jun 2021 10:43:46 -0400 Subject: Rename more bg routines, vars, etc --- include/unk_02016B94.h | 169 +++++++++++++++++++++++++------------------------ 1 file changed, 88 insertions(+), 81 deletions(-) (limited to 'include') diff --git a/include/unk_02016B94.h b/include/unk_02016B94.h index 9479f889..df9fa25a 100644 --- a/include/unk_02016B94.h +++ b/include/unk_02016B94.h @@ -38,7 +38,7 @@ struct Bg fx32 vOffset; u8 mode; - u8 unk1d; + u8 size; u8 colorMode; u8 tileSize; u16 rotation; @@ -136,81 +136,81 @@ void BG_LoadPlttData(u32 bgId, void *plttData, u32 size, u32 offset); void BG_SetMaskColor(u32 bgId, u32 value); u16 GetTileMapIndexFromCoords(u8 x, u8 y, u8 screenSize); u16 GetSrcTileMapIndexFromCoords(u8 x, u8 y, u8 width, u8 height); -void FUN_02018148(struct BgConfig *param0, - u32 param1, - void *param2, - u8 param3, - u8 param4, - u8 param5, - u8 param6); -void FUN_02018170(struct BgConfig *param0, - u32 param1, - u8 param2, - u8 param3, - u8 param4, - u8 param5, - void *param6, - u8 param7, - u8 param8, - u8 param9, - u8 param10); -void FUN_020181EC(struct BgConfig *param0, - u32 param1, - u8 param2, - u8 param3, - u8 param4, - u8 param5, - void *param6, - u8 param7, - u8 param8, - u8 param9, - u8 param10); -void FUN_02018268(struct Bg *bg, - u8 dstX, - u8 dstY, - u8 width, - u8 height, - u16 *src, - u8 srcX, - u8 srcY, - u8 srcWidth, - u8 srcHeight, - u8 param10); -void FUN_020183DC(struct Bg *param0, - u8 param1, - u8 param2, - u8 param3, - u8 param4, - u8 *param5, - u8 param6, - u8 param7, - u8 param8, - u8 param9, - u8 param10); -void FUN_02018540(struct BgConfig *param0, - u32 param1, - u16 param2, - u8 param3, - u8 param4, - u8 param5, - u8 param6, - u8 param7); -void FUN_02018590(struct Bg *param0, - u16 param1, - u8 param2, - u8 param3, - u8 param4, - u8 param5, - u8 param6); -void FUN_02018640( - struct Bg *param0, u8 param1, u8 param2, u8 param3, u8 param4, u8 param5); -void FUN_020186B4(struct BgConfig *param0, - u32 param1, - u8 param2, - u8 param3, - u8 param4, - u8 param5, - u8 param6); +void LoadRectToBgTilemapRect(struct BgConfig *bgConfig, + u32 bgId, + void *src, + u8 dstX, + u8 dstY, + u8 width, + u8 height); +void CopyToBgTilemapRect(struct BgConfig *bgConfig, + u32 bgId, + u8 dstX, + u8 dstY, + u8 dstWidth, + u8 dstHeight, + void *src, + u8 srcX, + u8 srcY, + u8 srcWidth, + u8 srcHeight); +void CopyRectToBgTilemapRect(struct BgConfig *bgConfig, + u32 bgId, + u8 dstX, + u8 dstY, + u8 dstWidth, + u8 dstHeight, + void *src, + u8 srcX, + u8 srcY, + u8 srcWidth, + u8 srcHeight); +void CopyBgTilemapRectText(struct Bg *bg, + u8 dstX, + u8 dstY, + u8 dstWidth, + u8 dstHeight, + u16 *src, + u8 srcX, + u8 srcY, + u8 srcWidth, + u8 srcHeight, + u8 adjustForSrcDims); +void CopyBgTilemapRectAffine(struct Bg *bg, + u8 dstX, + u8 dstY, + u8 dstWidth, + u8 dstHeight, + u8 *src, + u8 srcX, + u8 srcY, + u8 srcWidth, + u8 srcHeight, + u8 adjustForSrcDims); +void FillBgTilemapRect(struct BgConfig *bgConfig, + u32 bgId, + u16 fillValue, + u8 x, + u8 y, + u8 width, + u8 height, + u8 paletteNum); +void FillBgTilemapRectText(struct Bg *bg, + u16 fillValue, + u8 x, + u8 y, + u8 width, + u8 height, + u8 paletteNum); +void FillBgTilemapRectAffine( + struct Bg *bg, u8 fillValue, u8 x, u8 y, u8 width, u8 height); +void BgTilemapRectChangePalette(struct BgConfig *bgConfig, + u32 bgId, + u8 x, + u8 y, + u8 width, + u8 height, + u8 paletteNum); void FUN_02018744(struct BgConfig *param0, u32 param1); void FUN_02018768(struct BgConfig *param0, u32 param1, u16 param2); void FUN_0201878C(struct BgConfig *param0, u32 param1, u16 param2); @@ -271,9 +271,9 @@ void PutWindowTilemap(struct Window *window); void PutWindowTilemapRectAnchoredTopLeft(struct Window *window, u8 width, u8 height); void FUN_020192B8(struct Window *window); void PutWindowTilemap_TextMode(struct Window *param0); -void PutWindowTilemap_AffineMode(struct Window *param0); -void FUN_020193B4(struct Window *param0); -void FUN_02019444(struct Window *param0); +void PutWindowTilemap_AffineMode(struct Window *window); +void ClearWindowTilemapText(struct Window *window); +void ClearWindowTilemapAffine(struct Window *window); void CopyWindowToVram_TextMode(struct Window *window); void FUN_020194C8(struct Window *window); void CopyWindowToVram_AffineMode(struct Window *window); @@ -308,8 +308,15 @@ void BlitBitmapRect(struct Window *window, u16 param9, u16 param10); void FillWindowPixelRect(struct Window *window, u8 fillValue, u16 x, u16 y, u16 width, u16 height); -void FUN_0201974C( - struct Window *window, u32 *param1, u32 param2, u32 param3, u16 param4, u16 param5, u32 param6); +void CopyGlyphToWindow( + struct Window * window, + const char * src, + u16 srcWidth, + u16 srcHeight, + u16 width, + u16 height, + u16 glyph +); void ScrollWindow(struct Window *window, u32 param1, u8 param2, u8 param3); void ScrollWindow4bpp(struct Window *window, u32 param1, u8 param2, u8 fillValue); void ScrollWindow8bpp(struct Window *window, u32 param1, u8 param2, u8 fillValue); -- cgit v1.2.3 From 0ae4f320d929e4d8914002836055c1aad35d5ce3 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 5 Jun 2021 15:49:41 -0400 Subject: Name remaining symbols in {unk_02016B94->bg_window}.c --- include/bg_window.h | 416 +++++++++++++++++++++++++++++++++++++++++++++ include/gf_gfx_loader.h | 2 +- include/list_menu_cursor.h | 2 +- include/script.h | 2 +- include/script_buffers.h | 2 +- include/text.h | 2 +- include/text_02054590.h | 2 +- include/unk_02016B94.h | 345 ------------------------------------- 8 files changed, 422 insertions(+), 351 deletions(-) create mode 100644 include/bg_window.h delete mode 100644 include/unk_02016B94.h (limited to 'include') diff --git a/include/bg_window.h b/include/bg_window.h new file mode 100644 index 00000000..91026b4d --- /dev/null +++ b/include/bg_window.h @@ -0,0 +1,416 @@ +#ifndef POKEDIAMOND_UNK_02016B94_H +#define POKEDIAMOND_UNK_02016B94_H + +#include "NNS_g2d.h" +#include "global.h" +#include "GX_layers.h" +#include "MI_uncompress.h" +#include "OS_cache.h" +#include "gx.h" +#include "heap.h" +#include "math_util.h" + +struct BgTemplate +{ + u32 unk00; + u32 unk04; + u32 bufferSize; + u32 unk0c; + + u8 size; + u8 colorMode; + u8 screenBase; + u8 charBase; + u8 bgExtPltt; + u8 priority; + u8 areaOver; + u8 unk17; // probably paddding + u32 mosaic; +}; + +struct Bg +{ + void *tilemapBuffer; + u32 bufferSize; + u32 baseTile; + + fx32 hOffset; + fx32 vOffset; + + u8 mode; + u8 size; + u8 colorMode; + u8 tileSize; + u16 rotation; + u16 unk22; // probably padding + fx32 xScale; + fx32 yScale; + fx32 centerX; + fx32 centerY; +}; + +struct BgConfig +{ + u32 heap_id; + u16 scrollScheduled; + u16 bufferTransferScheduled; + struct Bg bgs[8]; +}; + +struct Bitmap +{ + const u8 *pixels; + u16 width; + u16 height; +}; + +struct WindowTemplate +{ + u8 bgId; + u8 tilemapLeft; + u8 tilemapTop; + u8 width; + u8 height; + u8 paletteNum; + u16 baseTile; +}; + +struct Window +{ + struct BgConfig *bgConfig; + u8 bgId; + u8 tilemapLeft; + u8 tilemapTop; + u8 width; + u8 height; + u8 paletteNum; + u16 baseTile : 15; + u16 unk0b_15 : 1; + void *pixelBuffer; +}; + +enum GFBgLayer +{ + GF_BG_LYR_MAIN_0 = 0, + GF_BG_LYR_MAIN_1, + GF_BG_LYR_MAIN_2, + GF_BG_LYR_MAIN_3, + GF_BG_LYR_SUB_0, + GF_BG_LYR_SUB_1, + GF_BG_LYR_SUB_2, + GF_BG_LYR_SUB_3, + GF_BG_LYR_MAIN_CNT = 4, + GF_BG_LYR_SUB_CNT = 4, + GF_BG_LYR_MAIN_FIRST = GF_BG_LYR_MAIN_0, + GF_BG_LYR_SUB_FIRST = GF_BG_LYR_SUB_0, + + GF_BG_LYR_MAIN_0_F = 1 << (GF_BG_LYR_MAIN_0 - GF_BG_LYR_MAIN_FIRST), + GF_BG_LYR_MAIN_1_F = 1 << (GF_BG_LYR_MAIN_1 - GF_BG_LYR_MAIN_FIRST), + GF_BG_LYR_MAIN_2_F = 1 << (GF_BG_LYR_MAIN_2 - GF_BG_LYR_MAIN_FIRST), + GF_BG_LYR_MAIN_3_F = 1 << (GF_BG_LYR_MAIN_3 - GF_BG_LYR_MAIN_FIRST), + GF_BG_LYR_SUB_0_F = 1 << (GF_BG_LYR_SUB_0 - GF_BG_LYR_SUB_FIRST), + GF_BG_LYR_SUB_1_F = 1 << (GF_BG_LYR_SUB_1 - GF_BG_LYR_SUB_FIRST), + GF_BG_LYR_SUB_2_F = 1 << (GF_BG_LYR_SUB_2 - GF_BG_LYR_SUB_FIRST), + GF_BG_LYR_SUB_3_F = 1 << (GF_BG_LYR_SUB_3 - GF_BG_LYR_SUB_FIRST), +}; + +enum GFBgType +{ + GF_BG_TYPE_TEXT = 0, + GF_BG_TYPE_AFFINE, + GF_BG_TYPE_256x16PLTT, +}; + +enum GFBgCntSet +{ + GF_BG_CNT_SET_COLOR_MODE = 0, + GF_BG_CNT_SET_SCREEN_BASE, + GF_BG_CNT_SET_CHAR_BASE, +}; + +enum GFBgScreenSize +{ + GF_BG_SCR_SIZE_128x128 = 0, + GF_BG_SCR_SIZE_256x256, + GF_BG_SCR_SIZE_256x512, + GF_BG_SCR_SIZE_512x256, + GF_BG_SCR_SIZE_512x512, + GF_BG_SCR_SIZE_1024x1024 +}; + +enum BgPosAdjustOp +{ + // Text layers + BG_POS_OP_SET_X = 0, + BG_POS_OP_ADD_X, + BG_POS_OP_SUB_X, + BG_POS_OP_SET_Y, + BG_POS_OP_ADD_Y, + BG_POS_OP_SUB_Y, + + // Affine layers + BG_POS_OP_SET_ROT = 0, + BG_POS_OP_ADD_ROT, + BG_POS_OP_SUB_ROT, + BG_POS_OP_SET_CENTERX = 9, + BG_POS_OP_ADD_CENTERX, + BG_POS_OP_SUB_CENTERX, + BG_POS_OP_SET_CENTERY, + BG_POS_OP_ADD_CENTERY, + BG_POS_OP_SUB_CENTERY, +}; + +struct BgConfig *BgConfig_Alloc(u32 heap_id); +u32 BgConfig_GetHeapId(struct BgConfig *bgConfig); +void SetBothScreensModesAndDisable(const struct GraphicsModes *modes); +void SetScreenModeAndDisable(const struct GraphicsModes *gfxModes, u32 whichScreen); +void InitBgFromTemplate( + struct BgConfig *bgConfig, u8 bgId, const struct BgTemplate *template, u8 bgMode); +void SetBgControlParam(struct BgConfig *config, u8 bgId, u32 attr, u8 value); +u8 TranslateGFBgModePairToGXScreenSize(u8 size, u32 bgMode); +void GetBgScreenDimensions(u32 screenSize, u8 *width_p, u8 *height_p); +void FreeBgTilemapBuffer(struct BgConfig *bgConfig, u32 bgId); +void SetBgPriority(u32 bgId, u16 priority); +void ToggleBgLayer(u32 bgId, GX_LayerToggle toggle); +void BgSetPosTextAndCommit(struct BgConfig *bgConfig, u32 bgId, u32 op, fx32 val); +fx32 Bg_GetXpos(struct BgConfig *bgConfig, u32 bgId); +fx32 Bg_GetYpos(struct BgConfig *bgConfig, u32 bgId); +void Bg_SetTextDimAndAffineParams(struct BgConfig *bgConfig, + u32 bgId, + u32 txOp, + fx32 txVal, + struct Mtx22 *mtx, + fx32 centerX, + fx32 centerY); +void Bg_SetPosText(struct Bg *bg, u32 op, fx32 val); +void SetBgAffine(struct BgConfig *bgConfig, + u32 bgId, + struct Mtx22 *mtx, + fx32 centerX, + fx32 centerY); +void BgAffineReset(struct BgConfig *bgConfig, u32 bgId); +void CopyOrUncompressTilemapData(const void *src, void *dest, u32 size); +void BgCommitTilemapBufferToVram(struct BgConfig *bgConfig, u32 bgId); +void BgCopyOrUncompressTilemapBufferRangeToVram( + struct BgConfig *bgConfig, u32 bgId, u32 *src, u32 size, u32 tileOffset); +void LoadBgVramScr(u32 bgId, void *buffer_p, u32 offset, u32 size); +void BG_LoadScreenTilemapData(struct BgConfig *bgConfig, u32 bgId, void *src, u32 numTiles); +void BG_LoadCharTilesData( + struct BgConfig *bgConfig, u32 bgId, u32 *charData, u32 offset, u32 numTiles); +void BG_LoadCharPixelData( + struct BgConfig *bgConfig, u32 bgId, u32 *charData, u32 size, u32 offset); +void LoadBgVramChar(u32 bgId, void *buffer_p, u32 offset, u32 size); +void BG_ClearCharDataRange(u32 bgId, u32 size, u32 offset, u32 heap_id); +void BG_FillCharDataRange( + struct BgConfig *param0, u32 bgId, u32 fillValue, u32 count, u32 offset); +void BG_LoadPlttData(u32 bgId, void *plttData, u32 size, u32 offset); +void BG_SetMaskColor(u32 bgId, u32 value); +u16 GetTileMapIndexFromCoords(u8 x, u8 y, u8 screenSize); +u16 GetSrcTileMapIndexFromCoords(u8 x, u8 y, u8 width, u8 height); +void LoadRectToBgTilemapRect(struct BgConfig *bgConfig, + u32 bgId, + void *src, + u8 dstX, + u8 dstY, + u8 width, + u8 height); +void CopyToBgTilemapRect(struct BgConfig *bgConfig, + u32 bgId, + u8 dstX, + u8 dstY, + u8 dstWidth, + u8 dstHeight, + void *src, + u8 srcX, + u8 srcY, + u8 srcWidth, + u8 srcHeight); +void CopyRectToBgTilemapRect(struct BgConfig *bgConfig, + u32 bgId, + u8 dstX, + u8 dstY, + u8 dstWidth, + u8 dstHeight, + void *src, + u8 srcX, + u8 srcY, + u8 srcWidth, + u8 srcHeight); +void CopyBgTilemapRectText(struct Bg *bg, + u8 dstX, + u8 dstY, + u8 dstWidth, + u8 dstHeight, + u16 *src, + u8 srcX, + u8 srcY, + u8 srcWidth, + u8 srcHeight, + u8 adjustForSrcDims); +void CopyBgTilemapRectAffine(struct Bg *bg, + u8 dstX, + u8 dstY, + u8 dstWidth, + u8 dstHeight, + u8 *src, + u8 srcX, + u8 srcY, + u8 srcWidth, + u8 srcHeight, + u8 adjustForSrcDims); +void FillBgTilemapRect(struct BgConfig *bgConfig, + u32 bgId, + u16 fillValue, + u8 x, + u8 y, + u8 width, + u8 height, + u8 paletteNum); +void FillBgTilemapRectText(struct Bg *bg, + u16 fillValue, + u8 x, + u8 y, + u8 width, + u8 height, + u8 paletteNum); +void FillBgTilemapRectAffine( + struct Bg *bg, u8 fillValue, u8 x, u8 y, u8 width, u8 height); +void BgTilemapRectChangePalette(struct BgConfig *bgConfig, + u32 bgId, + u8 x, + u8 y, + u8 width, + u8 height, + u8 paletteNum); +void BgClearTilemapBufferAndCommit(struct BgConfig *bgConfig, u32 bgId); +void BgFillTilemapBufferAndCommit(struct BgConfig *bgConfig, u32 bgId, u16 fillValue); +void BgFillTilemapBufferAndSchedule(struct BgConfig *bgConfig, u32 bgId, u16 fillValue); +void *BgGetCharPtr(u32 bgId); +void Convert4bppTo8bppInternal(u8 *src4bpp, u32 size, u8 (*dest8bpp), u8 paletteNum); +u8 *Convert4bppTo8bpp(u8 *src4Bpp, u32 size, u8 paletteNum, u32 heap_id); +void *GetBgTilemapBuffer(struct BgConfig *bgConfig, u8 bgId); +u16 GetBgAffineRotation(struct BgConfig *bgConfig, u32 bgId); +u8 GetBgPriority(struct BgConfig *bgConfig, u32 bgId); +void BlitBitmapRect4Bit(const struct Bitmap *src, + const struct Bitmap *dst, + u16 srcX, + u16 srcY, + u16 dstX, + u16 dstY, + u16 width, + u16 height, + u16 colorKey); +void BlitBitmapRect8Bit(const struct Bitmap *src, + const struct Bitmap *dst, + u16 srcX, + u16 srcY, + u16 dstX, + u16 dstY, + u16 width, + u16 height, + u16 colorKey); +void FillBitmapRect4Bit( + struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); +void FillBitmapRect8Bit( + struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); +struct Window *AllocWindows(u32 heap_id, s32 size); +void InitWindow(struct Window *window); +BOOL WindowIsInUse(struct Window *window); +void AddWindowParameterized(struct BgConfig *param0, + struct Window *window, + u8 bgId, + u8 tilemapLeft, + u8 tilemapTop, + u8 width, + u8 height, + u8 paletteNum, + u16 baseTile); +void AddTextWindowTopLeftCorner(struct BgConfig *param0, + struct Window *window, + u8 width, + u8 height, + u16 baseTile, + u8 paletteNum); +void AddWindow(struct BgConfig *bgConfig, + struct Window *window, + const struct WindowTemplate *template); +void RemoveWindow(struct Window *window); +void WindowArray_dtor(struct Window *windows, int count); +void CopyWindowToVram(struct Window *window); +void ScheduleWindowCopyToVram(struct Window *window); +void PutWindowTilemap(struct Window *window); +void PutWindowTilemapRectAnchoredTopLeft(struct Window *window, u8 width, u8 height); +void ClearWindowTilemap(struct Window *window); +void PutWindowTilemap_TextMode(struct Window *param0); +void PutWindowTilemap_AffineMode(struct Window *window); +void ClearWindowTilemapText(struct Window *window); +void ClearWindowTilemapAffine(struct Window *window); +void CopyWindowToVram_TextMode(struct Window *window); +void ScheduleWindowCopyToVram_TextMode(struct Window *window); +void CopyWindowToVram_AffineMode(struct Window *window); +void ScheduleWindowCopyToVram_AffineMode(struct Window *window); +void CopyWindowPixelsToVram_TextMode(struct Window *window); +void ClearWindowTilemapAndCopyToVram(struct Window *window); +void ClearWindowTilemapAndScheduleTransfer(struct Window *window); +void ClearWindowTilemapAndCopyToVram_TextMode(struct Window *window); +void ClearWindowTilemapAndScheduleTransfer_TextMode(struct Window *window); +void ClearWindowTilemapAndCopyToVram_AffineMode(struct Window *window); +void ClearWindowTilemapAndScheduleTransfer_AffineMode(struct Window *window); +void FillWindowPixelBuffer(struct Window *window, u8 param1); +void BlitBitmapRectToWindow(struct Window *window, + const void *src, + u16 srcX, + u16 srcY, + u16 srcWidth, + u16 srcHeight, + u16 dstX, + u16 dstY, + u16 dstWidth, + u16 dstHeight); +void BlitBitmapRect(struct Window *window, + void *param1, + u16 param2, + u16 param3, + u16 param4, + u16 param5, + u16 param6, + u16 param7, + u16 param8, + u16 param9, + u16 param10); +void FillWindowPixelRect(struct Window *window, u8 fillValue, u16 x, u16 y, u16 width, u16 height); +void CopyGlyphToWindow( + struct Window * window, + const char * src, + u16 srcWidth, + u16 srcHeight, + u16 width, + u16 height, + u16 glyph +); +void ScrollWindow(struct Window *window, u32 param1, u8 param2, u8 param3); +void ScrollWindow4bpp(struct Window *window, u32 param1, u8 param2, u8 fillValue); +void ScrollWindow8bpp(struct Window *window, u32 param1, u8 param2, u8 fillValue); +u8 GetWindowBgId(struct Window *window); +u8 GetWindowWidth(struct Window *window); +u8 GetWindowHeight(struct Window *window); +u8 GetWindowX(struct Window *window); +u8 GetWindowY(struct Window *window); +void MoveWindowX(struct Window *window, u8 x); +void MoveWindowY(struct Window *window, u8 y); +void SetWindowPaletteNum(struct Window *window, u8 paletteNum); +NNSG2dCharacterData * LoadCharacterDataFromFile(void **char_ret, u32 heap_id, const char *path); +NNSG2dPaletteData * LoadPaletteDataFromFile(void **pltt_ret, u32 heap_id, const char *path); +void DoScheduledBgGpuUpdates(struct BgConfig *bgConfig); +void DoScheduledBgTilemapBufferTransfers(struct BgConfig *bgConfig); +void ScheduleBgTilemapBufferTransfer(struct BgConfig *bgConfig, u32 bgId); +void ApplyScheduledBgPosUpdate(struct BgConfig *bgConfig); +void ScheduleSetBgPosText(struct BgConfig *bgConfig, u32 bgId, u32 op, fx32 value); +void ScheduleSetBgAffineRotation(struct BgConfig *bgConfig, u32 bgId, u32 op, u16 value); +void Bg_SetAffineRotation(struct Bg *bg, u32 op, u16 val); +void ScheduleSetBgAffinePos(struct BgConfig *bgConfig, u32 bgId, u32 op, fx32 value); +void Bg_SetAffinePos(struct Bg *bg, u32 op, fx32 val); +u32 DoesPixelAtScreenXYMatchPtrVal(struct BgConfig *bgConfig, u8 bgId, u8 x, u8 y, u16 *src); +void ApplyFlipFlagsToTile(struct BgConfig *bgConfig, u8 flag, u8 *src); + +#endif // POKEDIAMOND_UNK_02016B94_H diff --git a/include/gf_gfx_loader.h b/include/gf_gfx_loader.h index 3f23d1ff..cb7de269 100644 --- a/include/gf_gfx_loader.h +++ b/include/gf_gfx_loader.h @@ -1,7 +1,7 @@ #ifndef POKEDIAMOND_GF_GFX_LOADER_H #define POKEDIAMOND_GF_GFX_LOADER_H -#include "unk_02016B94.h" +#include "bg_window.h" u32 GfGfxLoader_LoadCharData(NarcId narcId, s32 memberNo, struct BgConfig * unkStruct02016B94_2, u32 a3, u32 a4, u32 szByte, BOOL isCompressed, u32 heap_id); void GfGfxLoader_LoadScrnData(NarcId narcId, s32 memberNo, struct BgConfig * unkStruct02016B94_2, u32 a3, u32 a4, u32 szByte, BOOL isCompressed, u32 heap_id); diff --git a/include/list_menu_cursor.h b/include/list_menu_cursor.h index e4a4b6b9..a2337e9a 100644 --- a/include/list_menu_cursor.h +++ b/include/list_menu_cursor.h @@ -1,7 +1,7 @@ #ifndef POKEDIAMOND_LIST_MENU_CURSOR_H #define POKEDIAMOND_LIST_MENU_CURSOR_H -#include "unk_02016B94.h" +#include "bg_window.h" // TODO: Move to its own header, and fill it out struct ListMenuCursor diff --git a/include/script.h b/include/script.h index 2f5e6540..75b65f90 100644 --- a/include/script.h +++ b/include/script.h @@ -4,7 +4,7 @@ #include "global.h" #include "msgdata.h" #include "save_block_2.h" -#include "unk_02016B94.h" +#include "bg_window.h" struct ScriptContext; diff --git a/include/script_buffers.h b/include/script_buffers.h index 9a742545..b9f0e268 100644 --- a/include/script_buffers.h +++ b/include/script_buffers.h @@ -4,7 +4,7 @@ #include "pokemon.h" #include "pokemon_storage_system.h" #include "trainer_data.h" -#include "unk_02016B94.h" +#include "bg_window.h" struct UnkStruct_0200AA80_sub_sub { diff --git a/include/text.h b/include/text.h index c9984d75..034447c7 100644 --- a/include/text.h +++ b/include/text.h @@ -3,7 +3,7 @@ #include "global.h" #include "font.h" -#include "unk_02016B94.h" +#include "bg_window.h" #define CHAR_0 0x00A2 diff --git a/include/text_02054590.h b/include/text_02054590.h index eaffb2a0..b2f4898b 100644 --- a/include/text_02054590.h +++ b/include/text_02054590.h @@ -3,7 +3,7 @@ #include "global.h" #include "options.h" -#include "unk_02016B94.h" +#include "bg_window.h" #include "string16.h" diff --git a/include/unk_02016B94.h b/include/unk_02016B94.h deleted file mode 100644 index df9fa25a..00000000 --- a/include/unk_02016B94.h +++ /dev/null @@ -1,345 +0,0 @@ -#ifndef POKEDIAMOND_UNK_02016B94_H -#define POKEDIAMOND_UNK_02016B94_H - -#include "NNS_g2d.h" -#include "global.h" -#include "GX_layers.h" -#include "MI_uncompress.h" -#include "OS_cache.h" -#include "gx.h" -#include "heap.h" -#include "math_util.h" - -struct BgTemplate -{ - u32 unk00; - u32 unk04; - u32 bufferSize; - u32 unk0c; - - u8 unk10; - u8 colorMode; - u8 screenBase; - u8 charBase; - u8 bgExtPltt; - u8 priority; - u8 areaOver; - u8 unk17; // probably paddding - u32 mosaic; -}; - -struct Bg -{ - void *tilemapBuffer; - u32 bufferSize; - u32 unk10; - - fx32 hOffset; - fx32 vOffset; - - u8 mode; - u8 size; - u8 colorMode; - u8 tileSize; - u16 rotation; - u16 unk22; // probably padding - fx32 xScale; - fx32 yScale; - fx32 centerX; - fx32 centerY; -}; - -struct BgConfig -{ - u32 heap_id; - u16 scrollScheduled; - u16 bufferTransferScheduled; - struct Bg bgs[8]; -}; - -struct Bitmap -{ - const u8 *pixels; - u16 width; - u16 height; -}; - -struct WindowTemplate -{ - u8 bgId; - u8 tilemapLeft; - u8 tilemapTop; - u8 width; - u8 height; - u8 paletteNum; - u16 baseTile; -}; - -struct Window -{ - struct BgConfig *bgConfig; - u8 bgId; - u8 tilemapLeft; - u8 tilemapTop; - u8 width; - u8 height; - u8 paletteNum; - u16 baseTile : 15; - u16 unk0b_15 : 1; - void *pixelBuffer; -}; - -struct BgConfig *FUN_02016B94(u32 heap_id); -u32 FUN_02016BB8(u32 *param0); -void FUN_02016BBC(const struct GraphicsModes *modes); -void FUN_02016BF4(const struct GraphicsModes *param0, u32 param1); -void FUN_02016C18( - struct BgConfig *param0, u8 param1, const struct BgTemplate *template, u8 bgMode); -void FUN_020170F4(struct BgConfig *config, u8 bgId, u32 attr, u8 value); -u8 FUN_020177DC(u8 param0, u32 param1); -void GetBgScreenDimensions(u32 screenSize, u8 *width_p, u8 *height_p); -void FUN_020178A0(struct BgConfig *bgConfig, u32 bgId); -void FUN_020178BC(u32 bgId, u16 priority); -void ToggleBgLayer(u32 bgId, GX_LayerToggle toggle); -void FUN_020179E0(struct BgConfig *bgConfig, u32 bgId, u32 param2, fx32 val); -fx32 FUN_02017B48(struct BgConfig *param0, u32 param1); -fx32 FUN_02017B54(struct BgConfig *param0, u32 param1); -void FUN_02017B60(struct BgConfig *param0, - u32 param1, - u32 param2, - fx32 param3, - struct Mtx22 *param4, - fx32 param5, - fx32 param6); -void Bg_SetPosText(struct Bg *bg, u32 op, fx32 val); -void FUN_02017BD0(struct BgConfig *param0, - u32 param1, - struct Mtx22 *param2, - fx32 param3, - fx32 param4); -void FUN_02017C6C(struct BgConfig *param0, u32 param1); -void FUN_02017C98(const void *param0, void *param1, u32 param2); -void FUN_02017CD0(struct BgConfig *param0, u32 param1); -void FUN_02017CE8( - struct BgConfig *param0, u32 param1, u32 *param2, u32 param3, u32 param4); -void LoadBgVramScr(u32 bgId, void *buffer_p, u32 offset, u32 size); -void FUN_02017DFC(struct BgConfig *param0, u32 param1, void *param2, u32 param3); -void BG_LoadCharTilesData( - struct BgConfig *bgConfig, u32 bgId, u32 *charData, u32 offset, u32 numTiles); -void BG_LoadCharPixelData( - struct BgConfig *bgConfig, u32 bgId, u32 *charData, u32 size, u32 offset); -void LoadBgVramChar(u32 bgId, void *buffer_p, u32 offset, u32 size); -void BG_ClearCharDataRange(u32 bgId, u32 size, u32 offset, u32 heap_id); -void BG_FillCharDataRange( - struct BgConfig *param0, u32 bgId, u32 fillValue, u32 count, u32 offset); -void BG_LoadPlttData(u32 bgId, void *plttData, u32 size, u32 offset); -void BG_SetMaskColor(u32 bgId, u32 value); -u16 GetTileMapIndexFromCoords(u8 x, u8 y, u8 screenSize); -u16 GetSrcTileMapIndexFromCoords(u8 x, u8 y, u8 width, u8 height); -void LoadRectToBgTilemapRect(struct BgConfig *bgConfig, - u32 bgId, - void *src, - u8 dstX, - u8 dstY, - u8 width, - u8 height); -void CopyToBgTilemapRect(struct BgConfig *bgConfig, - u32 bgId, - u8 dstX, - u8 dstY, - u8 dstWidth, - u8 dstHeight, - void *src, - u8 srcX, - u8 srcY, - u8 srcWidth, - u8 srcHeight); -void CopyRectToBgTilemapRect(struct BgConfig *bgConfig, - u32 bgId, - u8 dstX, - u8 dstY, - u8 dstWidth, - u8 dstHeight, - void *src, - u8 srcX, - u8 srcY, - u8 srcWidth, - u8 srcHeight); -void CopyBgTilemapRectText(struct Bg *bg, - u8 dstX, - u8 dstY, - u8 dstWidth, - u8 dstHeight, - u16 *src, - u8 srcX, - u8 srcY, - u8 srcWidth, - u8 srcHeight, - u8 adjustForSrcDims); -void CopyBgTilemapRectAffine(struct Bg *bg, - u8 dstX, - u8 dstY, - u8 dstWidth, - u8 dstHeight, - u8 *src, - u8 srcX, - u8 srcY, - u8 srcWidth, - u8 srcHeight, - u8 adjustForSrcDims); -void FillBgTilemapRect(struct BgConfig *bgConfig, - u32 bgId, - u16 fillValue, - u8 x, - u8 y, - u8 width, - u8 height, - u8 paletteNum); -void FillBgTilemapRectText(struct Bg *bg, - u16 fillValue, - u8 x, - u8 y, - u8 width, - u8 height, - u8 paletteNum); -void FillBgTilemapRectAffine( - struct Bg *bg, u8 fillValue, u8 x, u8 y, u8 width, u8 height); -void BgTilemapRectChangePalette(struct BgConfig *bgConfig, - u32 bgId, - u8 x, - u8 y, - u8 width, - u8 height, - u8 paletteNum); -void FUN_02018744(struct BgConfig *param0, u32 param1); -void FUN_02018768(struct BgConfig *param0, u32 param1, u16 param2); -void FUN_0201878C(struct BgConfig *param0, u32 param1, u16 param2); -void *FUN_020187B0(u32 param0); -void FUN_02018808(u8 *param0, u32 param1, u8 (*param2)[2], u8 param3); -u8 (*FUN_02018848(u8 *param0, u32 param1, u8 param2, u32 heap_id))[2]; -void *GetBgTilemapBuffer(struct BgConfig *bgConfig, u8 bgId); -u16 FUN_02018878(struct BgConfig *param0, u32 param1); -u8 GetBgPriority(struct BgConfig *bgConfig, u32 bgId); -void BlitBitmapRect4Bit(const struct Bitmap *src, - const struct Bitmap *dst, - u16 srcX, - u16 srcY, - u16 dstX, - u16 dstY, - u16 width, - u16 height, - u16 colorKey); -void BlitBitmapRect8Bit(const struct Bitmap *src, - const struct Bitmap *dst, - u16 srcX, - u16 srcY, - u16 dstX, - u16 dstY, - u16 width, - u16 height, - u16 colorKey); -void FillBitmapRect4Bit( - struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); -void FillBitmapRect8Bit( - struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); -struct Window *AllocWindows(u32 heap_id, s32 size); -void InitWindow(struct Window *window); -BOOL WindowIsInUse(struct Window *window); -void AddWindowParameterized(struct BgConfig *param0, - struct Window *window, - u8 bgId, - u8 tilemapLeft, - u8 tilemapTop, - u8 width, - u8 height, - u8 paletteNum, - u16 baseTile); -void AddTextWindowTopLeftCorner(struct BgConfig *param0, - struct Window *window, - u8 width, - u8 height, - u16 baseTile, - u8 paletteNum); -void AddWindow(struct BgConfig *bgConfig, - struct Window *window, - const struct WindowTemplate *template); -void RemoveWindow(struct Window *window); -void WindowArray_dtor(struct Window *windows, int count); -void CopyWindowToVram(struct Window *window); -void FUN_02019220(struct Window *window); -void PutWindowTilemap(struct Window *window); -void PutWindowTilemapRectAnchoredTopLeft(struct Window *window, u8 width, u8 height); -void FUN_020192B8(struct Window *window); -void PutWindowTilemap_TextMode(struct Window *param0); -void PutWindowTilemap_AffineMode(struct Window *window); -void ClearWindowTilemapText(struct Window *window); -void ClearWindowTilemapAffine(struct Window *window); -void CopyWindowToVram_TextMode(struct Window *window); -void FUN_020194C8(struct Window *window); -void CopyWindowToVram_AffineMode(struct Window *window); -void FUN_0201951C(struct Window *window); -void FUN_02019548(struct Window *window); -void FUN_02019570(struct Window *window); -void FUN_0201958C(struct Window *window); -void FUN_020195A8(struct Window *window); -void FUN_020195D0(struct Window *window); -void FUN_020195E4(struct Window *window); -void FUN_0201960C(struct Window *window); -void FillWindowPixelBuffer(struct Window *window, u8 param1); -void BlitBitmapRectToWindow(struct Window *window, - const void *src, - u16 srcX, - u16 srcY, - u16 srcWidth, - u16 srcHeight, - u16 dstX, - u16 dstY, - u16 dstWidth, - u16 dstHeight); -void BlitBitmapRect(struct Window *window, - void *param1, - u16 param2, - u16 param3, - u16 param4, - u16 param5, - u16 param6, - u16 param7, - u16 param8, - u16 param9, - u16 param10); -void FillWindowPixelRect(struct Window *window, u8 fillValue, u16 x, u16 y, u16 width, u16 height); -void CopyGlyphToWindow( - struct Window * window, - const char * src, - u16 srcWidth, - u16 srcHeight, - u16 width, - u16 height, - u16 glyph -); -void ScrollWindow(struct Window *window, u32 param1, u8 param2, u8 param3); -void ScrollWindow4bpp(struct Window *window, u32 param1, u8 param2, u8 fillValue); -void ScrollWindow8bpp(struct Window *window, u32 param1, u8 param2, u8 fillValue); -u8 GetWindowBgId(struct Window *window); -u8 GetWindowWidth(struct Window *window); -u8 GetWindowHeight(struct Window *window); -u8 GetWindowX(struct Window *window); -u8 GetWindowY(struct Window *window); -void MoveWindowX(struct Window *window, u8 x); -void MoveWindowY(struct Window *window, u8 y); -void SetWindowPaletteNum(struct Window *window, u8 paletteNum); -NNSG2dCharacterData * LoadCharacterDataFromFile(void **char_ret, u32 heap_id, const char *path); -NNSG2dPaletteData * LoadPaletteDataFromFile(void **pltt_ret, u32 heap_id, const char *path); -void DoScheduledBgGpuUpdates(struct BgConfig *bgConfig); -void DoScheduledBgTilemapBufferTransfers(struct BgConfig *bgConfig); -void ScheduleBgTilemapBufferTransfer(struct BgConfig *bgConfig, u32 bgId); -void ApplyScheduledBgPosUpdate(struct BgConfig *bgConfig); -void ScheduleSetBgPosText(struct BgConfig *bgConfig, u32 bgId, u32 op, fx32 value); -void ScheduleSetBgAffineRotation(struct BgConfig *bgConfig, u32 bgId, u32 op, u16 value); -void Bg_SetAffineRotation(struct Bg *bg, u32 op, u16 val); -void ScheduleSetBgAffinePos(struct BgConfig *bgConfig, u32 bgId, u32 op, fx32 value); -void Bg_SetAffinePos(struct Bg *bg, u32 op, fx32 val); -u32 FUN_0201AFBC(struct BgConfig *bgConfig, u8 bgId, u8 x, u8 y, u16 *src); -void FUN_0201B118(struct BgConfig *param0, u8 param1, u8 *param2); - -#endif // POKEDIAMOND_UNK_02016B94_H -- cgit v1.2.3 From c87b617058767519480ef2d19e233fe0e99ca01d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 5 Jun 2021 16:55:46 -0400 Subject: Fix GX_vramcnt symbol names --- include/GX_layers.h | 6 ------ include/bg_window.h | 16 ++++++++++++---- include/timer3.h | 6 ------ 3 files changed, 12 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/GX_layers.h b/include/GX_layers.h index aca0154b..03c20df6 100644 --- a/include/GX_layers.h +++ b/include/GX_layers.h @@ -5,12 +5,6 @@ #include "global.h" #include "gx.h" -struct GX_LayerData -{ - u32 EngineB_DISPCNT_LayerMask; - u32 EngineA_DISPCNT_LayerMask; -}; - typedef enum { GX_LAYER_TOGGLE_OFF, diff --git a/include/bg_window.h b/include/bg_window.h index 91026b4d..24ed152b 100644 --- a/include/bg_window.h +++ b/include/bg_window.h @@ -12,10 +12,10 @@ struct BgTemplate { - u32 unk00; - u32 unk04; + u32 x; + u32 y; u32 bufferSize; - u32 unk0c; + u32 baseTile; u8 size; u8 colorMode; @@ -85,10 +85,16 @@ struct Window u8 height; u8 paletteNum; u16 baseTile : 15; - u16 unk0b_15 : 1; + u16 colorMode : 1; void *pixelBuffer; }; +enum GFBppMode +{ + GF_BG_CLR_4BPP = 0, + GF_BG_CLR_8BPP, +}; + enum GFBgLayer { GF_BG_LYR_MAIN_0 = 0, @@ -112,6 +118,8 @@ enum GFBgLayer GF_BG_LYR_SUB_1_F = 1 << (GF_BG_LYR_SUB_1 - GF_BG_LYR_SUB_FIRST), GF_BG_LYR_SUB_2_F = 1 << (GF_BG_LYR_SUB_2 - GF_BG_LYR_SUB_FIRST), GF_BG_LYR_SUB_3_F = 1 << (GF_BG_LYR_SUB_3 - GF_BG_LYR_SUB_FIRST), + + GF_BG_LYR_UNALLOC = 0xFF, }; enum GFBgType diff --git a/include/timer3.h b/include/timer3.h index 3220c7a3..a49cf3e6 100644 --- a/include/timer3.h +++ b/include/timer3.h @@ -4,12 +4,6 @@ #include "global.h" -struct Timer3Data -{ - BOOL NeedReset; - vu64 Timer3Counter; -}; - void Init_Timer3(); void CountUpTimer3(); u64 internal_GetTimer3Count(); -- cgit v1.2.3 From 4f743559340e199b4ca65bcc3bc5ea18569b138e Mon Sep 17 00:00:00 2001 From: red031000 Date: Sun, 6 Jun 2021 20:09:09 +0100 Subject: some progress on rowan's overlay --- include/player_data.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/player_data.h b/include/player_data.h index 5095ea61..c86db1c1 100644 --- a/include/player_data.h +++ b/include/player_data.h @@ -51,7 +51,7 @@ struct String * PlayerProfile_GetPlayerName_NewString(struct PlayerData * data, void PlayerProfile_SetTrainerID(struct PlayerData * data, u32 otid); u32 PlayerProfile_GetTrainerID(struct PlayerData * data); u16 PlayerProfile_GetTrainerID_VisibleHalf(struct PlayerData * data); -void PlayerProfile_SetTrainerGender(struct PlayerData * data, u8 gender); +void PlayerProfile_SetTrainerGender(struct PlayerData * data, u32 gender); u32 PlayerProfile_GetTrainerGender(struct PlayerData * data); BOOL PlayerProfile_TestBadgeFlag(struct PlayerData * data, u32 badgeno); void PlayerProfile_SetBadgeFlag(struct PlayerData * data, u32 badgeno); -- cgit v1.2.3 From d887b5d339c2801e3db17ad50529e45ed55addf2 Mon Sep 17 00:00:00 2001 From: red031000 Date: Sun, 6 Jun 2021 20:52:18 +0100 Subject: enum for gender --- include/player_data.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/player_data.h b/include/player_data.h index c86db1c1..132eb6ae 100644 --- a/include/player_data.h +++ b/include/player_data.h @@ -7,6 +7,12 @@ struct SaveBlock2; +typedef enum +{ + Male = 0, + Female = 1 +} GenderEnum; + struct PlayerData { /* 0x00 */ u16 playerName[OT_NAME_LENGTH + 1]; @@ -51,8 +57,8 @@ struct String * PlayerProfile_GetPlayerName_NewString(struct PlayerData * data, void PlayerProfile_SetTrainerID(struct PlayerData * data, u32 otid); u32 PlayerProfile_GetTrainerID(struct PlayerData * data); u16 PlayerProfile_GetTrainerID_VisibleHalf(struct PlayerData * data); -void PlayerProfile_SetTrainerGender(struct PlayerData * data, u32 gender); -u32 PlayerProfile_GetTrainerGender(struct PlayerData * data); +void PlayerProfile_SetTrainerGender(struct PlayerData * data, GenderEnum gender); +GenderEnum PlayerProfile_GetTrainerGender(struct PlayerData * data); BOOL PlayerProfile_TestBadgeFlag(struct PlayerData * data, u32 badgeno); void PlayerProfile_SetBadgeFlag(struct PlayerData * data, u32 badgeno); u32 PlayerProfile_CountBadges(struct PlayerData * data); -- cgit v1.2.3 From 3dc03263f5a796901b7f68a970e9167f37259eaf Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 10 Jun 2021 21:46:27 -0400 Subject: Decompile unk_02085338 --- include/mail_message.h | 2 +- include/unk_02085338.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 include/unk_02085338.h (limited to 'include') diff --git a/include/mail_message.h b/include/mail_message.h index 5772fdd3..c0ea2039 100644 --- a/include/mail_message.h +++ b/include/mail_message.h @@ -20,7 +20,7 @@ u32 MailMsg_NumFields(u16 bank, u16 num); u16 MailMsg_GetFieldI(struct MailMessage * mailMsg, u32 a1); u16 MailMsg_GetMsgBank(struct MailMessage * mailMsg); u16 MailMsg_GetMsgNo(struct MailMessage * mailMsg); -BOOL MailMsg_compare(struct MailMessage * mailMsg, struct MailMessage * a1); +BOOL MailMsg_compare(const struct MailMessage *mailMsg, const struct MailMessage *a1); void MailMsg_copy(struct MailMessage * mailMsg, const struct MailMessage * a1); u32 MailMsg_NumMsgsInBank(u16 bank); void MailMsg_SetMsgBankAndNum(struct MailMessage * mailMsg, u16 bank, u16 num); diff --git a/include/unk_02085338.h b/include/unk_02085338.h new file mode 100644 index 00000000..0517bf26 --- /dev/null +++ b/include/unk_02085338.h @@ -0,0 +1,47 @@ +#ifndef POKEDIAMOND_UNK_02085338_H +#define POKEDIAMOND_UNK_02085338_H + +#include "save_block_2.h" +#include "pokedex.h" +#include "unk_020139D8.h" + +struct UnkStruct_02085338 +{ + u8 unk_00; + u8 unk_01; + u8 unk_02; + u8 unk_03; + u8 unk_04; + u8 unk_05; + u32 unk_08; + struct Pokedex * unk_0c; + struct UnkStruct_02013B28 * unk_10; + struct MailMessage unk_14; + u16 unk_1c[2]; + u8 padding_20[4]; +}; + +struct UnkStruct_02085338 * FUN_02085338(u8 r5, u8 r7, struct SaveBlock2 * sav2, u32 heap_id); +void FUN_020853A8(struct UnkStruct_02085338 * ptr); +void FUN_020853B0(struct UnkStruct_02085338 * ptr, u16 a1); +void FUN_020853B4(struct UnkStruct_02085338 * ptr, u16 a1, u16 a2); +void FUN_020853BC(struct UnkStruct_02085338 * ptr, const struct MailMessage * a1); +void FUN_020853D0(struct UnkStruct_02085338 * ptr); +void FUN_020853DC(struct UnkStruct_02085338 * ptr); +u8 FUN_020853E4(struct UnkStruct_02085338 * ptr); +u8 FUN_020853E8(struct UnkStruct_02085338 * ptr); +u16 FUN_020853EC(struct UnkStruct_02085338 * ptr); +void FUN_020853F0(struct UnkStruct_02085338 * ptr, u16 * a1); +void FUN_020853FC(struct UnkStruct_02085338 * ptr, struct MailMessage * a1); +u8 FUN_0208540C(struct UnkStruct_02085338 * ptr); +u8 FUN_02085410(struct UnkStruct_02085338 * ptr); +u32 FUN_02085414(struct UnkStruct_02085338 * ptr); +struct Pokedex * FUN_02085418(struct UnkStruct_02085338 * ptr); +struct UnkStruct_02013B28 * FUN_0208541C(struct UnkStruct_02085338 * ptr); +u8 FUN_02085420(struct UnkStruct_02085338 * ptr); +u8 FUN_02085424(struct UnkStruct_02085338 * ptr); +void FUN_02085428(struct UnkStruct_02085338 * ptr, u16 * a1, struct MailMessage * a2); +BOOL FUN_0208545C(struct UnkStruct_02085338 * ptr, const u16 * a1, const struct MailMessage * a2); +void FUN_020854A0(struct UnkStruct_02085338 * r5, u16 * r4, struct MailMessage * r6); + +#endif //POKEDIAMOND_UNK_02085338_H -- cgit v1.2.3 From 0e92523067b31f9f9c17c1a06c76b62a801abc51 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 11 Jun 2021 21:55:07 -0400 Subject: Decompile unk_0205EC84, 2 --- include/unk_0205EC84.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 include/unk_0205EC84.h (limited to 'include') diff --git a/include/unk_0205EC84.h b/include/unk_0205EC84.h new file mode 100644 index 00000000..0cbf6f77 --- /dev/null +++ b/include/unk_0205EC84.h @@ -0,0 +1,58 @@ +#ifndef POKEDIAMOND_UNK_0205EC84_H +#define POKEDIAMOND_UNK_0205EC84_H + +#include "event_data.h" + +void FUN_0205ECD4(struct ScriptState * state); +BOOL FUN_0205ECE0(struct ScriptState * state); +BOOL FUN_0205ECEC(struct ScriptState * state); +void FUN_0205ECFC(struct ScriptState * state); +BOOL FUN_0205ED0C(struct ScriptState * state); +void FUN_0205ED1C(struct ScriptState * state); +void FUN_0205ED2C(struct ScriptState * state); +BOOL FUN_0205ED3C(struct ScriptState * state); +void FUN_0205ED4C(struct ScriptState * state); +void FUN_0205ED5C(struct ScriptState * state); +BOOL FUN_0205ED6C(struct ScriptState * state); +void FUN_0205ED7C(struct ScriptState * state); +void FUN_0205ED8C(struct ScriptState * state); +BOOL FUN_0205ED9C(struct ScriptState * state); +void FUN_0205EDAC(struct ScriptState * state); +void FUN_0205EDBC(struct ScriptState * state); +void FUN_0205EDCC(struct ScriptState * state); +void FUN_0205EDD8(struct ScriptState * state); +void FUN_0205EDE8(struct ScriptState * state); +void FUN_0205EDF8(struct ScriptState * state); +void FUN_0205EE08(struct ScriptState * state, u32 a1); +BOOL FUN_0205EE60(struct ScriptState * state, u32 a1); +BOOL FUN_0205EEB8(struct ScriptState * state, u32 a1); +s32 FUN_0205EF20(struct ScriptState * state, s32 a1); +void FUN_0205F154(struct ScriptState * state); +void FUN_0205F164(struct ScriptState * state); +BOOL FUN_0205F174(struct ScriptState * state); +BOOL FUN_0205F184(struct ScriptState * state); +BOOL FUN_0205F194(struct ScriptState * state); +BOOL FUN_0205F1A4(struct ScriptState * state); +BOOL FUN_0205F1B4(struct ScriptState * state); +void FUN_0205F1C4(struct ScriptState * state); +void FUN_0205F1D4(struct ScriptState * state); +BOOL FUN_0205F1E4(struct ScriptState * state); +void FUN_0205F1F4(struct ScriptState * state); +void FUN_0205F204(struct ScriptState * state); +BOOL FUN_0205F214(struct ScriptState * state); +void FUN_0205F224(struct ScriptState * state); +void FUN_0205F234(struct ScriptState * state); +BOOL FUN_0205F244(struct ScriptState * state); +void FUN_0205F254(struct ScriptState * state); +BOOL FUN_0205F264(struct ScriptState * state, u32 op); +void FUN_0205F274(struct ScriptState * state); +void FUN_0205F284(struct ScriptState * state); +BOOL FUN_0205F294(struct ScriptState * state); +void FUN_0205F2A4(struct ScriptState * state); +void FUN_0205F2B4(struct ScriptState * state); +BOOL FUN_0205F2C4(struct ScriptState * state); +BOOL FUN_0205F2D4(struct ScriptState * state, u32 op); +BOOL FUN_0205F2E4(struct ScriptState * state, u32 op, u16 flag_id); +void FUN_0205F304(struct ScriptState * state); + +#endif //POKEDIAMOND_UNK_0205EC84_H -- cgit v1.2.3 From 4b1053c21cf22b9eca6f556139f52414b91f523b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 12 Jun 2021 13:32:50 -0400 Subject: Decompile overlay 19 --- include/gf_gfx_loader.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/gf_gfx_loader.h b/include/gf_gfx_loader.h index cb7de269..32d63449 100644 --- a/include/gf_gfx_loader.h +++ b/include/gf_gfx_loader.h @@ -2,15 +2,16 @@ #define POKEDIAMOND_GF_GFX_LOADER_H #include "bg_window.h" +#include "filesystem.h" -u32 GfGfxLoader_LoadCharData(NarcId narcId, s32 memberNo, struct BgConfig * unkStruct02016B94_2, u32 a3, u32 a4, u32 szByte, BOOL isCompressed, u32 heap_id); -void GfGfxLoader_LoadScrnData(NarcId narcId, s32 memberNo, struct BgConfig * unkStruct02016B94_2, u32 a3, u32 a4, u32 szByte, BOOL isCompressed, u32 heap_id); -void GfGfxLoader_GXLoadPal(NarcId narcId, s32 memberNo, u32 whichRoutine, u32 baseAddr, u32 szByte, u32 heap_id); -void GfGfxLoader_GXLoadPalWithSrcOffset(NarcId narcId, s32 memberNo, u32 whichRoutine, u32 srcOffset, u32 baseAddr, u32 szByte, u32 heap_id); -u32 GfGfxLoader_LoadWholePalette(NarcId narcId, s32 memberId, u32 whichRoutine, u32 baseAddr, u32 szByte, BOOL isCompressed, u32 heap_id); +u32 GfGfxLoader_LoadCharData(NarcId narcId, s32 memberNo, struct BgConfig * unkStruct02016B94_2, u32 layer, u32 numTiles, u32 szByte, BOOL isCompressed, u32 heap_id); +void GfGfxLoader_LoadScrnData(NarcId narcId, s32 memberNo, struct BgConfig * unkStruct02016B94_2, u32 layer, u32 tileOffset, u32 szByte, BOOL isCompressed, u32 heap_id); +void GfGfxLoader_GXLoadPal(NarcId narcId, s32 memberNo, u32 layer, u32 baseAddr, u32 szByte, u32 heap_id); +void GfGfxLoader_GXLoadPalWithSrcOffset(NarcId narcId, s32 memberNo, u32 layer, u32 srcOffset, u32 baseAddr, u32 szByte, u32 heap_id); +u32 GfGfxLoader_LoadWholePalette(NarcId narcId, s32 memberId, u32 layer, u32 baseAddr, u32 szByte, BOOL isCompressed, u32 heap_id); void GfGfxLoader_PartiallyLoadPalette(NarcId narcId, s32 memberId, NNS_G2D_VRAM_TYPE vramType, u32 baseAddr, u32 heap_id, NNSG2dImagePaletteProxy * pPltProxy); -u32 GfGfxLoader_LoadImageMapping(NarcId narcId, s32 memberId, BOOL isCompressed, u32 whichRoutine, u32 szByte, NNS_G2D_VRAM_TYPE type, u32 baseAddr, u32 heap_id, NNSG2dImageProxy *pImgProxy); -void GfGfxLoader_SetObjCntFlagsAndLoadImageMapping(NarcId narcId, s32 memberId, BOOL isCompressed, u32 whichRoutine, u32 szByte, NNS_G2D_VRAM_TYPE type, u32 baseAddr, u32 heap_id, NNSG2dImageProxy * pImageProxy); +u32 GfGfxLoader_LoadImageMapping(NarcId narcId, s32 memberId, BOOL isCompressed, u32 layer, u32 szByte, NNS_G2D_VRAM_TYPE type, u32 baseAddr, u32 heap_id, NNSG2dImageProxy *pImgProxy); +void GfGfxLoader_SetObjCntFlagsAndLoadImageMapping(NarcId narcId, s32 memberId, BOOL isCompressed, u32 layer, u32 szByte, NNS_G2D_VRAM_TYPE type, u32 baseAddr, u32 heap_id, NNSG2dImageProxy * pImageProxy); void * GfGfxLoader_GetCharData(NarcId narcId, s32 memberId, BOOL isCompressed, NNSG2dCharacterData ** ppCharData, u32 heap_id); void * GfGfxLoader_GetScrnData(NarcId narcId, s32 memberId, BOOL isCompressed, NNSG2dScreenData ** ppScrData, u32 heap_id); void * GfGfxLoader_GetPlttData(NarcId narcId, s32 memberId, NNSG2dPaletteData ** ppPltData, u32 heap_id); -- cgit v1.2.3 From 97ad09c896ba222ade14b52c9c625bbe70824711 Mon Sep 17 00:00:00 2001 From: tgsm Date: Sat, 12 Jun 2021 21:07:09 -0500 Subject: Decompile scrcmd_18 -> scrcmd_party --- include/scrcmd.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'include') diff --git a/include/scrcmd.h b/include/scrcmd.h index 91cb306c..4f68e728 100644 --- a/include/scrcmd.h +++ b/include/scrcmd.h @@ -249,6 +249,42 @@ BOOL ScrCmd_Unk01AD(struct ScriptContext* ctx); //scrcmd_18.c BOOL ScrCmd_GiveMon(struct ScriptContext* ctx); +BOOL ScrCmd_GetPartyMonSpecies(struct ScriptContext* ctx); +BOOL ScrCmd_CheckPartyMonOTID(struct ScriptContext* ctx); +BOOL ScrCmd_GiveEgg(struct ScriptContext* ctx); +BOOL ScrCmd_SetPartyMonMove(struct ScriptContext* ctx); +BOOL ScrCmd_PartyMonHasMove(struct ScriptContext* ctx); +BOOL ScrCmd_FindPartyMonWithMove(struct ScriptContext* ctx); +BOOL ScrCmd_SurvivePsn(struct ScriptContext* ctx); +BOOL ScrCmd_CountPartyMonsAtOrBelowLevel(struct ScriptContext* ctx); +BOOL ScrCmd_GetPartyMonLevel(struct ScriptContext* ctx); +BOOL ScrCmd_GetPartyMonNature(struct ScriptContext* ctx); +BOOL ScrCmd_FindPartyMonWithNature(struct ScriptContext* ctx); +BOOL ScrCmd_GetPartyMonFriendship(struct ScriptContext* ctx); +BOOL ScrCmd_AddPartyMonFriendship(struct ScriptContext* ctx); +BOOL ScrCmd_DepletePartyMonFriendship(struct ScriptContext* ctx); +BOOL ScrCmd_GetPartyMonContestCondition(struct ScriptContext* ctx); +BOOL ScrCmd_GetLeadingPartyMonSlot(struct ScriptContext* ctx); +BOOL ScrCmd_GetPartyMonTypes(struct ScriptContext* ctx); +BOOL ScrCmd_CountPartyMons(struct ScriptContext* ctx); +BOOL ScrCmd_CountPartyMons_OmitEggs(struct ScriptContext* ctx); +BOOL ScrCmd_CountAvailablePartyMons_IgnoreSlot(struct ScriptContext* ctx); +BOOL ScrCmd_CountAvailablePartyMonsAndPCMons(struct ScriptContext* ctx); +BOOL ScrCmd_GetPartyEggCount(struct ScriptContext* ctx); +BOOL ScrCmd_CheckPartyForPokerus(struct ScriptContext* ctx); +BOOL ScrCmd_GetPartyMonGender(struct ScriptContext* ctx); +BOOL ScrCmd_CountPartyMonMoves(struct ScriptContext* ctx); +BOOL ScrCmd_ForgetPartyMonMove(struct ScriptContext* ctx); +BOOL ScrCmd_GetPartyMonMove(struct ScriptContext* ctx); +BOOL ScrCmd_GetPartyMonHeldItem(struct ScriptContext* ctx); +BOOL ScrCmd_ResetPartyMonHeldItem(struct ScriptContext* ctx); +BOOL ScrCmd_CheckPartyForSpecies(struct ScriptContext* ctx); +BOOL ScrCmd_CountPartyMonRibbons(struct ScriptContext* ctx); +BOOL ScrCmd_Unk022F(struct ScriptContext* ctx); +BOOL ScrCmd_PartyMonHasRibbon(struct ScriptContext* ctx); +BOOL ScrCmd_GivePartyMonRibbon(struct ScriptContext* ctx); +BOOL ScrCmd_CheckPartyForBadEgg(struct ScriptContext* ctx); +BOOL ScrCmd_Unk00A0(struct ScriptContext* ctx); //scrcmd_fossils.c BOOL ScrCmd_CountFossils(struct ScriptContext* ctx); -- cgit v1.2.3 From ca14c9ab605a7a40d1c85cec99a4ef4f3ec2cbd2 Mon Sep 17 00:00:00 2001 From: tgsm Date: Sat, 12 Jun 2021 21:41:08 -0500 Subject: scrcmd_party: address review comments --- include/scrcmd.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/scrcmd.h b/include/scrcmd.h index 4f68e728..826b74d3 100644 --- a/include/scrcmd.h +++ b/include/scrcmd.h @@ -262,14 +262,14 @@ BOOL ScrCmd_GetPartyMonNature(struct ScriptContext* ctx); BOOL ScrCmd_FindPartyMonWithNature(struct ScriptContext* ctx); BOOL ScrCmd_GetPartyMonFriendship(struct ScriptContext* ctx); BOOL ScrCmd_AddPartyMonFriendship(struct ScriptContext* ctx); -BOOL ScrCmd_DepletePartyMonFriendship(struct ScriptContext* ctx); +BOOL ScrCmd_SubtractPartyMonFriendship(struct ScriptContext* ctx); BOOL ScrCmd_GetPartyMonContestCondition(struct ScriptContext* ctx); BOOL ScrCmd_GetLeadingPartyMonSlot(struct ScriptContext* ctx); BOOL ScrCmd_GetPartyMonTypes(struct ScriptContext* ctx); BOOL ScrCmd_CountPartyMons(struct ScriptContext* ctx); BOOL ScrCmd_CountPartyMons_OmitEggs(struct ScriptContext* ctx); BOOL ScrCmd_CountAvailablePartyMons_IgnoreSlot(struct ScriptContext* ctx); -BOOL ScrCmd_CountAvailablePartyMonsAndPCMons(struct ScriptContext* ctx); +BOOL ScrCmd_CountAvailablePartyAndPCMons(struct ScriptContext* ctx); BOOL ScrCmd_GetPartyEggCount(struct ScriptContext* ctx); BOOL ScrCmd_CheckPartyForPokerus(struct ScriptContext* ctx); BOOL ScrCmd_GetPartyMonGender(struct ScriptContext* ctx); @@ -280,7 +280,7 @@ BOOL ScrCmd_GetPartyMonHeldItem(struct ScriptContext* ctx); BOOL ScrCmd_ResetPartyMonHeldItem(struct ScriptContext* ctx); BOOL ScrCmd_CheckPartyForSpecies(struct ScriptContext* ctx); BOOL ScrCmd_CountPartyMonRibbons(struct ScriptContext* ctx); -BOOL ScrCmd_Unk022F(struct ScriptContext* ctx); +BOOL ScrCmd_CountTotalPartyRibbons(struct ScriptContext* ctx); BOOL ScrCmd_PartyMonHasRibbon(struct ScriptContext* ctx); BOOL ScrCmd_GivePartyMonRibbon(struct ScriptContext* ctx); BOOL ScrCmd_CheckPartyForBadEgg(struct ScriptContext* ctx); -- cgit v1.2.3 From a94dd3fd396f3b77944e13dcc13348da60a97abc Mon Sep 17 00:00:00 2001 From: Gogume1er Date: Fri, 18 Jun 2021 21:59:25 +0200 Subject: decompile unk_0206E2F0.s --- include/bag.h | 8 +------- include/bag_view.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 include/bag_view.h (limited to 'include') diff --git a/include/bag.h b/include/bag.h index 14735443..a785afc6 100644 --- a/include/bag.h +++ b/include/bag.h @@ -1,6 +1,7 @@ #ifndef POKEDIAMOND_BAG_H #define POKEDIAMOND_BAG_H +#include "bag_view.h" #include "itemtool.h" #include "save_block_2.h" @@ -17,13 +18,6 @@ struct Bag u32 registeredItem; }; -struct BagView -{ - struct ItemSlot * slots; - u32 count; - u8 pocket; -}; - struct UnkStruct_0206F164 { u8 unk_00[8]; diff --git a/include/bag_view.h b/include/bag_view.h new file mode 100644 index 00000000..423d2677 --- /dev/null +++ b/include/bag_view.h @@ -0,0 +1,56 @@ +#ifndef POKEDIAMOND_BAG_VIEW_H +#define POKEDIAMOND_BAG_VIEW_H + +#include "player_data.h" +#include "save_block_2.h" + +struct UnkStruct_0206F164; + +struct BagView_UnkSub +{ + struct ItemSlot *slot; + u8 padding[0x4]; + u8 pocket; + u8 padding2[0x3]; +}; // total size = 0xC + +struct BagView +{ + struct SaveBlock2 *sav2; + struct BagView_UnkSub slots[8]; + u8 padding; + u8 unk65; + u16 unk66; + u16 unk68; + u8 padding2[0x2]; + struct UnkStruct_0206F164 *unk6C; + u32 unk70; + u8 unk74; + u8 unk75; + u16 unk76 : 1; + u16 unk76_2 : 15; +}; // total size = 0x78 + +struct BagView *BagView_New(u8 heap_id); +u32 BagView_sizeof(); +void FUN_0206E30C(struct BagView *bag_view, u8 r1); +void FUN_0206E314( + struct BagView *bag_view, struct SaveBlock2 *sav2, u8 r2, struct UnkStruct_0206F164 *r3); +void BagView_SetItem(struct BagView *bag_view, struct ItemSlot *slot, u8 pocket, u8 idx); +void FUN_0206E340(struct BagView *bag_view); +void FUN_0206E354(struct BagView *bag_view, u32 r1); +void FUN_0206E358(struct BagView *bag_view, u8 r1); +void FUN_0206E360(struct BagView *bag_view, u16 r1); +u16 FUN_0206E37C(struct BagView *bag_view); +u16 FUN_0206E384(struct BagView *bag_view); +u8 FUN_0206E38C(struct BagView *bag_view); +u8 FUN_0206E394(struct BagView *bag_view); +u32 FUN_0206E39C(struct SaveBlock2 *sav2); +u32 FUN_0206E3A8(struct SaveBlock2 *sav2); +u32 FUN_0206E3C8(struct SaveBlock2 *sav2); +u32 FUN_0206E3D8(struct SaveBlock2 *sav2); +u32 FUN_0206E3E8(struct SaveBlock2 *sav2); +BOOL FUN_0206E3F8(struct SaveBlock2 *sav2, struct String *dest, u32 item_id, u32 heap_id); +void FUN_0206E51C(struct PlayerData *playerData, struct String *dest, u32 r2, u32 r3, u32 heap_id); + +#endif // POKEDIAMOND_BAG_VIEW_H -- cgit v1.2.3 From 7ec4479631d6fe7bc7153f548294e93d0543f182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 19 Jun 2021 14:04:44 +0200 Subject: decompile unk_020023C0.s --- include/unk_0201B8B8.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/unk_0201B8B8.h b/include/unk_0201B8B8.h index 13bc217b..26dd8017 100644 --- a/include/unk_0201B8B8.h +++ b/include/unk_0201B8B8.h @@ -2,8 +2,8 @@ #define POKEDIAMOND_UNK_0201B8B88_H const u16 * MsgArray_SkipControlCode(const u16 * r4); -u16 MsgArray_GetControlCode(const u16 * r4); +u32 MsgArray_GetControlCode(const u16 * r4); BOOL MsgArray_ControlCodeIsStrVar(const u16 * r4); -u16 MsgArray_ControlCodeGetField(const u16 * r5, u32 r4); +u32 MsgArray_ControlCodeGetField(const u16 * r5, u32 r4); #endif //POKEDIAMOND_UNK_0201B8B88_H -- cgit v1.2.3 From f3e07750802c57b4a17be2144242295e154d616b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 19 Jun 2021 14:21:00 +0200 Subject: silence warnings --- include/unk_020023C0.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 include/unk_020023C0.h (limited to 'include') diff --git a/include/unk_020023C0.h b/include/unk_020023C0.h new file mode 100644 index 00000000..503628c6 --- /dev/null +++ b/include/unk_020023C0.h @@ -0,0 +1,43 @@ +#include "global.h" +#include "text.h" + +typedef struct +{ + u8 canABSpeedUpPrint : 1; + u8 useAlternateDownArrow : 1; + u8 autoScroll : 1; + u8 forceMidTextSpeed : 1; + u8 unk0_4 : 1; + u8 unk0_5 : 1; + u8 unk0_6 : 1; + u8 unk0_7 : 1; + u8 unk1; +} TextFlags; + +struct TextPrinterSubStruct +{ + u8 glyphId : 4; // 0x14 + u8 hasPrintBeenSpedUp : 1; + u8 unk : 3; + u8 downArrowDelay : 5; + u8 downArrowYPosIdx : 2; + u8 hasGlyphIdBeenSet : 1; + u8 autoScrollDelay : 8; +}; + +u32 RenderText(struct TextPrinter *printer); +void FUN_02002840(u16 flag); +void FUN_0200284C(struct TextPrinter *printer); +void FUN_02002878(struct TextPrinter *printer); +void FUN_02002A00(struct TextPrinter *printer); +u32 FUN_02002A94(struct TextPrinter *printer); +u32 FUN_02002ADC(struct TextPrinter *printer); +u32 FUN_02002B18(struct TextPrinter *printer); +u8 FUN_02002B3C(struct TextPrinter *printer); +void FUN_02002B60(u32 param0); +void FUN_02002B7C(s32 param0); +void FUN_02002BB8(u32 param0); +u8 FUN_02002BD4(); +void FUN_02002BE4(); +u8 FUN_02002BF4(); +void FUN_02002C04(); -- cgit v1.2.3 From b8290ba524554302d67c3f23e2cf002447e6d4c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 19 Jun 2021 14:23:58 +0200 Subject: change filename --- include/render_text.h | 43 +++++++++++++++++++++++++++++++++++++++++++ include/unk_020023C0.h | 43 ------------------------------------------- 2 files changed, 43 insertions(+), 43 deletions(-) create mode 100644 include/render_text.h delete mode 100644 include/unk_020023C0.h (limited to 'include') diff --git a/include/render_text.h b/include/render_text.h new file mode 100644 index 00000000..503628c6 --- /dev/null +++ b/include/render_text.h @@ -0,0 +1,43 @@ +#include "global.h" +#include "text.h" + +typedef struct +{ + u8 canABSpeedUpPrint : 1; + u8 useAlternateDownArrow : 1; + u8 autoScroll : 1; + u8 forceMidTextSpeed : 1; + u8 unk0_4 : 1; + u8 unk0_5 : 1; + u8 unk0_6 : 1; + u8 unk0_7 : 1; + u8 unk1; +} TextFlags; + +struct TextPrinterSubStruct +{ + u8 glyphId : 4; // 0x14 + u8 hasPrintBeenSpedUp : 1; + u8 unk : 3; + u8 downArrowDelay : 5; + u8 downArrowYPosIdx : 2; + u8 hasGlyphIdBeenSet : 1; + u8 autoScrollDelay : 8; +}; + +u32 RenderText(struct TextPrinter *printer); +void FUN_02002840(u16 flag); +void FUN_0200284C(struct TextPrinter *printer); +void FUN_02002878(struct TextPrinter *printer); +void FUN_02002A00(struct TextPrinter *printer); +u32 FUN_02002A94(struct TextPrinter *printer); +u32 FUN_02002ADC(struct TextPrinter *printer); +u32 FUN_02002B18(struct TextPrinter *printer); +u8 FUN_02002B3C(struct TextPrinter *printer); +void FUN_02002B60(u32 param0); +void FUN_02002B7C(s32 param0); +void FUN_02002BB8(u32 param0); +u8 FUN_02002BD4(); +void FUN_02002BE4(); +u8 FUN_02002BF4(); +void FUN_02002C04(); diff --git a/include/unk_020023C0.h b/include/unk_020023C0.h deleted file mode 100644 index 503628c6..00000000 --- a/include/unk_020023C0.h +++ /dev/null @@ -1,43 +0,0 @@ -#include "global.h" -#include "text.h" - -typedef struct -{ - u8 canABSpeedUpPrint : 1; - u8 useAlternateDownArrow : 1; - u8 autoScroll : 1; - u8 forceMidTextSpeed : 1; - u8 unk0_4 : 1; - u8 unk0_5 : 1; - u8 unk0_6 : 1; - u8 unk0_7 : 1; - u8 unk1; -} TextFlags; - -struct TextPrinterSubStruct -{ - u8 glyphId : 4; // 0x14 - u8 hasPrintBeenSpedUp : 1; - u8 unk : 3; - u8 downArrowDelay : 5; - u8 downArrowYPosIdx : 2; - u8 hasGlyphIdBeenSet : 1; - u8 autoScrollDelay : 8; -}; - -u32 RenderText(struct TextPrinter *printer); -void FUN_02002840(u16 flag); -void FUN_0200284C(struct TextPrinter *printer); -void FUN_02002878(struct TextPrinter *printer); -void FUN_02002A00(struct TextPrinter *printer); -u32 FUN_02002A94(struct TextPrinter *printer); -u32 FUN_02002ADC(struct TextPrinter *printer); -u32 FUN_02002B18(struct TextPrinter *printer); -u8 FUN_02002B3C(struct TextPrinter *printer); -void FUN_02002B60(u32 param0); -void FUN_02002B7C(s32 param0); -void FUN_02002BB8(u32 param0); -u8 FUN_02002BD4(); -void FUN_02002BE4(); -u8 FUN_02002BF4(); -void FUN_02002C04(); -- cgit v1.2.3 From a252c28863e078fd8ea65f4ad228308585de92c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 19 Jun 2021 14:43:22 +0200 Subject: rename symbols based on pokeemerald --- include/render_text.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/render_text.h b/include/render_text.h index 503628c6..94002caf 100644 --- a/include/render_text.h +++ b/include/render_text.h @@ -27,14 +27,14 @@ struct TextPrinterSubStruct u32 RenderText(struct TextPrinter *printer); void FUN_02002840(u16 flag); -void FUN_0200284C(struct TextPrinter *printer); -void FUN_02002878(struct TextPrinter *printer); -void FUN_02002A00(struct TextPrinter *printer); -u32 FUN_02002A94(struct TextPrinter *printer); -u32 FUN_02002ADC(struct TextPrinter *printer); -u32 FUN_02002B18(struct TextPrinter *printer); -u8 FUN_02002B3C(struct TextPrinter *printer); -void FUN_02002B60(u32 param0); +void TextPrinterInitDownArrowCounters(struct TextPrinter *printer); +void TextPrinterDrawDownArrow(struct TextPrinter *printer); +void TextPrinterClearDownArrow(struct TextPrinter *printer); +BOOL TextPrinterContinue(struct TextPrinter *printer); +BOOL TextPrinterWaitAutoMode(struct TextPrinter *printer); +BOOL TextPrinterWaitWithDownArrow(struct TextPrinter *printer); +u8 TextPrinterWait(struct TextPrinter *printer); +void TextFlags_SetCanABSpeedUpPrint(BOOL param0); void FUN_02002B7C(s32 param0); void FUN_02002BB8(u32 param0); u8 FUN_02002BD4(); -- cgit v1.2.3 From 3e8c37cf1fee349756ff7f0fe9b0b693622bfa73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 19 Jun 2021 15:20:23 +0200 Subject: header guards --- include/render_text.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/render_text.h b/include/render_text.h index 94002caf..e3e0f4c8 100644 --- a/include/render_text.h +++ b/include/render_text.h @@ -1,3 +1,6 @@ +#ifndef POKEDIAMOND_RENDER_TEXT_H +#define POKEDIAMOND_RENDER_TEXT_H + #include "global.h" #include "text.h" @@ -41,3 +44,5 @@ u8 FUN_02002BD4(); void FUN_02002BE4(); u8 FUN_02002BF4(); void FUN_02002C04(); + +#endif // POKEDIAMOND_RENDER_TEXT_H -- cgit v1.2.3 From ce9a6097573a1a64e199b9b91fbf2e1de483dad5 Mon Sep 17 00:00:00 2001 From: Gogume1er Date: Sat, 19 Jun 2021 15:41:23 +0200 Subject: decompile unk_02088AAC.s --- include/unk_020851B8.h | 2 +- include/unk_02088AAC.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 include/unk_02088AAC.h (limited to 'include') diff --git a/include/unk_020851B8.h b/include/unk_020851B8.h index ca47a91c..334ba4c8 100644 --- a/include/unk_020851B8.h +++ b/include/unk_020851B8.h @@ -10,7 +10,7 @@ struct UnkStruct_020851B8 { }; struct UnkStruct_020851B8 *FUN_020851B8(u32 heap_id); -void FUN_020851DC(struct UnkStruct_020851B8 *param0, u32 param1, BOOL param2); +void FUN_020851DC(struct UnkStruct_020851B8 *param0, u16 param1, BOOL param2); void FUN_020851F8(struct UnkStruct_020851B8 *param0, u8 param1, u8 param2, u8 param3); void FUN_02085200(struct UnkStruct_020851B8 *param0, u16 param1); u8 FUN_02085224(struct UnkStruct_020851B8 *param0, u16 param1); diff --git a/include/unk_02088AAC.h b/include/unk_02088AAC.h new file mode 100644 index 00000000..d4d7cf3e --- /dev/null +++ b/include/unk_02088AAC.h @@ -0,0 +1,31 @@ +#ifndef POKEDIAMOND_UNK_02088AAC_H +#define POKEDIAMOND_UNK_02088AAC_H + +#include "bag.h" +#include "main.h" +#include "unk_0208890C.h" + +struct UnkStruct_02088AAC +{ + u32 heap_id; + u16 unk04; + u16 unk06; + u32 item; + struct UnkStruct_0206F164 *unk0C; + struct UnkStruct_0208890C *unk10; + u32 unk14; + void *ovly_param; + struct UnkStruct_02006234 *ovly_data; + u32 unk20; +}; + +u32 FUN_02088AAC(struct UnkStruct_02088AAC *r0, u32 *r1); +u32 FUN_02088AFC(struct UnkStruct_02088AAC *r0); +u32 FUN_02088B28(struct UnkStruct_02088AAC *r0); +u32 FUN_02088B48(void); +u32 FUN_02088B4C(struct UnkStruct_02088AAC *r0); +u32 FUN_02088BA8(struct UnkStruct_02088AAC *r0); +u32 FUN_02088C3C(struct UnkStruct_02088AAC *r0); +u32 FUN_02088CDC(struct UnkStruct_02088AAC *r0); + +#endif // POKEDIAMOND_UNK_02088AAC_H -- cgit v1.2.3 From dc026c3c75898a9e3a0ea8533af4e02c5156ead6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sun, 20 Jun 2021 09:16:14 +0200 Subject: delete obsolete externs --- include/text_02054590.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/text_02054590.h b/include/text_02054590.h index b2f4898b..4d05260a 100644 --- a/include/text_02054590.h +++ b/include/text_02054590.h @@ -12,7 +12,7 @@ void FUN_020545B8(struct BgConfig *param0, struct Window *param1, u32 param2); void FUN_02054608(struct Window *param0, struct Options *options); void FUN_0205464C(struct Window *param0); u16 FUN_02054658(struct Window * window, struct String *str, struct Options *options, u8 param3); -u16 DrawFieldMessage(struct Window * window, struct String *str, u8 fontId, u32 speed, u8 a4, u32 a5); +u16 DrawFieldMessage(struct Window * window, struct String *str, u8 fontId, u32 speed, u8 a4, s32 a5); u8 FUN_020546C8(u32 param0); void FUN_020546E0(struct BgConfig *param0, struct Window *param1, u32 param2, u32 param3); void FUN_02054744(struct Window *param0, u32 param1, u32 param2); -- cgit v1.2.3