diff options
| author | Derek Hensley <hensley.derek58@gmail.com> | 2024-12-28 07:59:22 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-28 08:59:22 -0700 |
| commit | cb54eb49e47301ca806a754954bee17e23fe6f40 (patch) | |
| tree | 26e03acbe8c346477331b8d12d236a35ee6749f8 | |
| parent | 7ba4585497a63eb64e7ca33aa53ca22695760739 (diff) | |
6FD190 + 6FD410 OK (#235)
* func_800D94F0_jp
* func_800D9514_jp
* func_800D9524_jp
* func_800D955C_jp
* func_800D9618_jp
* func_800D96A8_jp
* func_800D96E8_jp
* func_800D9700_jp
* func_800D9750_jp
* func_800D9760_jp
* func_800D9770_jp
* func_800D9788_jp
* func_800D97A0_jp
* func_800D97F8_jp
* func_800D986C_jp
* Split off 6FD410 based on bss
* Migrate bss
* add todo
* headers
* Better types for 6FD410 bss based on graph
* Cleanup
| -rw-r--r-- | Makefile | 1 | ||||
| -rw-r--r-- | include/6FD190.h | 22 | ||||
| -rw-r--r-- | include/6FD410.h | 16 | ||||
| -rw-r--r-- | include/code_variables.h | 9 | ||||
| -rw-r--r-- | include/segment_symbols.h | 1 | ||||
| -rw-r--r-- | linker_scripts/jp/symbol_addrs_code.txt | 12 | ||||
| -rw-r--r-- | src/code/6FD190.c | 115 | ||||
| -rw-r--r-- | src/code/6FD410.c | 51 | ||||
| -rw-r--r-- | yamls/jp/code.yaml | 6 | ||||
| -rw-r--r-- | yamls/jp/framebuffer.yaml | 8 |
10 files changed, 213 insertions, 28 deletions
@@ -292,6 +292,7 @@ setup: extract: $(RM) -r asm/$(VERSION) assets/$(VERSION) $(CAT) yamls/$(VERSION)/header.yaml \ + yamls/$(VERSION)/framebuffer.yaml \ yamls/$(VERSION)/makerom.yaml \ yamls/$(VERSION)/boot.yaml \ yamls/$(VERSION)/code.yaml \ diff --git a/include/6FD190.h b/include/6FD190.h index f2744db..868991e 100644 --- a/include/6FD190.h +++ b/include/6FD190.h @@ -3,21 +3,17 @@ #include "ultra64.h" #include "libc/stdint.h" +#include "unk.h" uintptr_t func_800D94F0_jp(void); -// void func_800D9514_jp(); +void func_800D9514_jp(void); void func_800D9524_jp(void); -void func_800D955C_jp(s32); -// void func_800D9618_jp(); -// void func_800D96A8_jp(); -// void func_800D96E8_jp(); -// void func_800D9700_jp(); -// void func_800D9750_jp(); -// void func_800D9760_jp(); -// void func_800D9770_jp(); -// void func_800D9788_jp(); -// void func_800D97A0_jp(); -// void func_800D97F8_jp(); -// void func_800D986C_jp(); +void func_800D955C_jp(s32 arg0); +void func_800D9618_jp(s32 arg0); +void func_800D96A8_jp(void); +u16* func_800D96E8_jp(s32 arg0); +s32 func_800D9700_jp(void); +UNK_PTR func_800D9750_jp(void); +uintptr_t func_800D9760_jp(void); #endif diff --git a/include/6FD410.h b/include/6FD410.h new file mode 100644 index 0000000..3420caf --- /dev/null +++ b/include/6FD410.h @@ -0,0 +1,16 @@ +#ifndef C_6FD410_H +#define C_6FD410_H + +#include "ultra64.h" +#include "unk.h" + +void func_800D9770_jp(void); +void func_800D9788_jp(void); +UNK_PTR func_800D97A0_jp(u32 arg0); +UNK_PTR func_800D97F8_jp(u32 arg0); +void func_800D986C_jp(s32 arg0); + +extern u32 B_80146080_jp; +extern UNK_PTR B_80146084_jp; + +#endif diff --git a/include/code_variables.h b/include/code_variables.h index 15eedd8..fd72184 100644 --- a/include/code_variables.h +++ b/include/code_variables.h @@ -1674,6 +1674,8 @@ extern u8 D_80113854_jp; // .bss +extern u16 D_80000400[]; + // extern UNK_TYPE B_8011B830_jp; // extern UNK_TYPE B_8011B83C_jp; @@ -1972,13 +1974,6 @@ extern UNK_TYPE B_80145FFC_jp; // extern UNK_TYPE B_80146044_jp; // extern UNK_TYPE B_80146050_jp; // extern UNK_TYPE B_80146058_jp; -// extern UNK_TYPE B_80146060_jp; -// extern UNK_TYPE B_80146064_jp; -// extern UNK_TYPE B_80146068_jp; -// extern UNK_TYPE B_8014606C_jp; -// extern UNK_TYPE B_80146070_jp; -// extern UNK_TYPE B_80146080_jp; -// extern UNK_TYPE B_80146084_jp; // extern UNK_TYPE B_FLT_80146090_jp; // extern UNK_TYPE B_FLT_80146094_jp; // extern UNK_TYPE B_FLT_80146098_jp; diff --git a/include/segment_symbols.h b/include/segment_symbols.h index a04ca19..bdea287 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -45,6 +45,7 @@ #define SEGMENT_BSS_END(segment) (segment ## _BSS_END) #define SEGMENT_BSS_SIZE(segment) ((uintptr_t)SEGMENT_BSS_END(segment) - (uintptr_t)SEGMENT_BSS_START(segment)) +DECLARE_SEGMENT(framebuffer); DECLARE_SEGMENT(header); diff --git a/linker_scripts/jp/symbol_addrs_code.txt b/linker_scripts/jp/symbol_addrs_code.txt index 8615732..37e0054 100644 --- a/linker_scripts/jp/symbol_addrs_code.txt +++ b/linker_scripts/jp/symbol_addrs_code.txt @@ -6208,13 +6208,11 @@ B_80146040_jp = 0x80146040; // B_80146044_jp = 0x80146044; // B_80146050_jp = 0x80146050; // B_80146058_jp = 0x80146058; // -B_80146060_jp = 0x80146060; // -B_80146064_jp = 0x80146064; // -B_80146068_jp = 0x80146068; // -B_8014606C_jp = 0x8014606C; // -B_80146070_jp = 0x80146070; // -B_80146080_jp = 0x80146080; // -B_80146084_jp = 0x80146084; // +B_80146060_jp = 0x80146060; // size:0xC +B_8014606C_jp = 0x8014606C; // size:0x4 +B_80146070_jp = 0x80146070; // size:0x4 +B_80146080_jp = 0x80146080; // size:0x4 +B_80146084_jp = 0x80146084; // size:0x4 B_FLT_80146090_jp = 0x80146090; // type:f32 B_FLT_80146094_jp = 0x80146094; // type:f32 B_FLT_80146098_jp = 0x80146098; // type:f32 diff --git a/src/code/6FD190.c b/src/code/6FD190.c new file mode 100644 index 0000000..d10af01 --- /dev/null +++ b/src/code/6FD190.c @@ -0,0 +1,115 @@ +#include "6FD190.h" + +#include "6FD410.h" +#include "alignment.h" +#include "code_variables.h" +#include "libc64/malloc.h" +#include "segment_symbols.h" +#include "unk.h" + +u16* B_80146060_jp[3]; +UNK_PTR B_8014606C_jp; +uintptr_t B_80146070_jp; + +uintptr_t func_800D94F0_jp(void) { + B_80146070_jp = 0x80400000; + B_80146070_jp &= ~0x3F; + return B_80146070_jp; +} + +void func_800D9514_jp(void) { + B_80146070_jp = 0; +} + +void func_800D9524_jp(void) { + B_80146060_jp[0] = NULL; + B_80146060_jp[1] = NULL; + B_80146060_jp[2] = NULL; + B_8014606C_jp = NULL; + func_800D9770_jp(); +} + +void func_800D955C_jp(s32 arg0) { + switch (arg0) { + case 0: + B_80146060_jp[0] = D_80000400; + break; + + case 1: + B_80146060_jp[1] = (u16*)ALIGN64((uintptr_t)malloc_r(0x2583F)); + break; + + case 2: + B_8014606C_jp = (UNK_PTR)ALIGN64((uintptr_t)malloc(0x2583F)); + break; + + case 3: + B_80146060_jp[2] = (u16*)ALIGN64((uintptr_t)malloc(0x2583F)); + break; + + default: + break; + } +} + +void func_800D9618_jp(s32 arg0) { + switch (arg0) { + case 0: + B_80146060_jp[0] = NULL; + break; + + case 1: + free(B_80146060_jp[1]); + B_80146060_jp[1] = NULL; + break; + + case 2: + free(B_8014606C_jp); + B_8014606C_jp = NULL; + break; + + case 3: + free(B_80146060_jp[2]); + B_80146060_jp[2] = NULL; + break; + + default: + break; + } +} + +void func_800D96A8_jp(void) { + func_800D9788_jp(); + func_800D9618_jp(0); + func_800D9618_jp(1); + func_800D9618_jp(2); + func_800D9618_jp(3); +} + +u16* func_800D96E8_jp(s32 arg0) { + return B_80146060_jp[arg0]; +} + +s32 func_800D9700_jp(void) { + if (B_80146060_jp[2] != NULL) { + return 3; + } + + if (B_80146060_jp[1] != NULL) { + return 2; + } + + if (B_80146060_jp[0] != NULL) { + return 1; + } + + return 0; +} + +UNK_PTR func_800D9750_jp(void) { + return B_8014606C_jp; +} + +uintptr_t func_800D9760_jp(void) { + return B_80146070_jp; +} diff --git a/src/code/6FD410.c b/src/code/6FD410.c new file mode 100644 index 0000000..ab5ecc7 --- /dev/null +++ b/src/code/6FD410.c @@ -0,0 +1,51 @@ +#include "6FD410.h" + +#include "libc/stdbool.h" + +u32 B_80146080_jp; +UNK_PTR B_80146084_jp; + +void func_800D9770_jp(void) { + B_80146080_jp = 0; + B_80146084_jp = NULL; +} + +void func_800D9788_jp(void) { + B_80146080_jp = 0; + B_80146084_jp = NULL; +} + +UNK_PTR func_800D97A0_jp(u32 arg0) { + if (arg0 < 0x25800) { + if (B_80146080_jp == 0) { + B_80146080_jp = 1; + } else if (B_80146080_jp == 3) { + B_80146080_jp = 4; + return B_80146084_jp; + } + } + return NULL; +} + +UNK_PTR func_800D97F8_jp(u32 arg0) { + UNK_PTR ret; + u32 start = osGetCount(); + + while (true) { + if ((osGetCount() - start) > ((s32)(OS_NSEC_TO_CYCLES(1333333334)))) { + return 0; + } + + ret = func_800D97A0_jp(arg0); + if (ret != NULL) { + return ret; + } + } +} + +void func_800D986C_jp(s32 arg0) { + if (arg0) { + B_80146084_jp = NULL; + B_80146080_jp = 0; + } +} diff --git a/yamls/jp/code.yaml b/yamls/jp/code.yaml index 8b692d3..32f3aff 100644 --- a/yamls/jp/code.yaml +++ b/yamls/jp/code.yaml @@ -107,7 +107,8 @@ - [0x6FA6B0, asm, code/padmgr] - [0x6FB340, asm, code/6FB340] - [0x6FC540, asm, code/speed_meter] - - [0x6FD190, asm, code/6FD190] + - [0x6FD190, c, code/6FD190] + - [0x6FD410, c, code/6FD410] - [0x6FD530, c, code/sys_initial_check] - [0x6FD840, asm, code/sys_math] - [0x6FDC40, asm, code/sys_math3d] @@ -331,6 +332,9 @@ - { start: 0x73F4D0, type: .bss, vram: 0x80145620, name: code/lb_rtc} - { start: 0x73F4D0, type: .bss, vram: 0x80145630, name: code/main} - { start: 0x73F4D0, type: bss, vram: 0x801458E0, name: code/801458E0} + - { start: 0x73F4D0, type: .bss, vram: 0x80146060, name: code/6FD190} + - { start: 0x73F4D0, type: .bss, vram: 0x80146080, name: code/6FD410} + - { start: 0x73F4D0, type: bss, vram: 0x80146090, name: code/80146090} - { start: 0x73F4D0, type: .bss, vram: 0x801462B0, name: code/sys_matrix } - { start: 0x73F4D0, type: .bss, vram: 0x801462C0, name: code/sys_stacks } - { start: 0x73F4D0, type: .bss, vram: 0x801492C0, name: code/zurumode } diff --git a/yamls/jp/framebuffer.yaml b/yamls/jp/framebuffer.yaml new file mode 100644 index 0000000..41253fd --- /dev/null +++ b/yamls/jp/framebuffer.yaml @@ -0,0 +1,8 @@ + - name: framebuffer + type: code + start: 0x000000 + vram: 0x80000400 + notdma: True + bss_size: 0x24800 + subsegments: + - { start: 0x000000, type: bss, vram: 0x80000400, name: buffers/80000400} |
