From 4edcdeb8114e0952d584026c7ce564e749a7f07c Mon Sep 17 00:00:00 2001 From: rozlette Date: Thu, 25 Oct 2018 22:22:38 -0500 Subject: [PATCH] Fix tabs --- include/functions.h | 1 + include/variables.h | 1 + src/boot/boot_0x80080060.c | 198 ++++++++++----------- src/boot/boot_0x800805E0.c | 94 +++++----- src/boot/boot_0x80081820.c | 14 +- src/boot/boot_0x80085320.c | 174 +++++++++---------- src/boot/boot_0x80087830.c | 30 ++-- src/boot/boot_0x80087900.c | 14 +- src/boot/boot_0x80087E00.c | 2 +- src/boot/boot_0x8008A660.c.ignore | 104 +++++------ src/boot/boot_0x8008ACE0.c | 28 +-- src/boot/boot_0x8008D350.c.ignore | 50 +++--- src/boot/boot_0x80092920.c | 112 ++++++------ src/boot/boot_0x80095900.c | 18 +- src/boot/boot_0x800968B0.c | 20 +-- src/code/code_0x800A5AC0.c | 64 +++---- src/code/code_0x800BF9A0.c | 36 ++-- src/code/code_0x800CAAD0.c | 170 +++++++++--------- src/libultra/io/contquery.c | 36 ++-- src/libultra/io/sirawread.c | 14 +- src/libultra/io/spgetstat.c | 2 +- src/libultra/io/spsetstat.c | 2 +- src/libultra/io/sptask.c | 98 +++++------ src/libultra/io/vigetcurrcontext.c | 2 +- src/libultra/libc/string.c | 44 ++--- src/libultra/os/createthread.c | 34 ++-- src/libultra/os/destroythread.c | 56 +++--- src/libultra/os/getcurrfaultthread.c | 2 +- src/libultra/os/getthreadid.c | 8 +- src/libultra/os/jammesg.c | 38 ++--- src/libultra/os/recvmesg.c | 50 +++--- src/libultra/os/sendmesg.c | 52 +++--- src/libultra/os/seteventmesg.c | 36 ++-- src/libultra/os/startthread.c | 62 +++---- src/libultra/os/stopthread.c | 46 ++--- src/libultra/os/stoptimer.c | 50 +++--- src/libultra/os/thread.c | 22 +-- src/libultra/os/virtualtophysical.c | 14 +- src/olv_En_Test.c.ignore | 246 +++++++++++++-------------- src/test.c | 44 ++--- 40 files changed, 1045 insertions(+), 1043 deletions(-) diff --git a/include/functions.h b/include/functions.h index 1296d3b9fd..98ba1e7ffb 100644 --- a/include/functions.h +++ b/include/functions.h @@ -3,6 +3,7 @@ #include #include +#include #include #include diff --git a/include/variables.h b/include/variables.h index bc560442f3..2790d7de9b 100644 --- a/include/variables.h +++ b/include/variables.h @@ -3,6 +3,7 @@ #include #include +#include #include #include diff --git a/src/boot/boot_0x80080060.c b/src/boot/boot_0x80080060.c index e10e84d8d1..1601b48666 100644 --- a/src/boot/boot_0x80080060.c +++ b/src/boot/boot_0x80080060.c @@ -2,127 +2,127 @@ #include UNK_RET func_80080060(void) { - func_80085320(&D_80099500, &D_80099AF0, &D_80099EF0, 0, -1, &D_80098190); - D_80000318 = func_8008D350(); - func_800818F4(); - func_8008A6FC(); - func_8008EDE0(); - D_80096B40 = func_80092920(); - func_80085320(&D_80099AD0, &D_800996D0, &D_80099AD0_, 0, 256, &D_80098198); - osCreateThread(&D_80099520, 1, (void(*)(void*))func_80080514, 0, &D_80099AD0, 12); - func_800957B0(&D_80099520); + func_80085320(&D_80099500, &D_80099AF0, &D_80099EF0, 0, -1, &D_80098190); + D_80000318 = func_8008D350(); + func_800818F4(); + func_8008A6FC(); + func_8008EDE0(); + D_80096B40 = func_80092920(); + func_80085320(&D_80099AD0, &D_800996D0, &D_80099AD0_, 0, 256, &D_80098198); + osCreateThread(&D_80099520, 1, (void(*)(void*))func_80080514, 0, &D_80099AD0, 12); + func_800957B0(&D_80099520); } void func_80080150(UNK_PTR a0, UNK_PTR a1) { - if (a0 < a1) { - func_80089630(a0, (u32)a1 - (u32)a0); - } + if (a0 < a1) { + func_80089630(a0, (u32)a1 - (u32)a0); + } } void func_80080180(UNK_TYPE* a0, UNK_TYPE a1, UNK_TYPE a2) { - for (; a1 != 0; a1 -= 4) { - *a0++ = a2; - } + for (; a1 != 0; a1 -= 4) { + *a0++ = a2; + } } UNK_RET func_8008019C(void) { - func_80080180(&D_80000500, 0x25800, 0x00010001); - func_800805E0(0); - func_8008FE60(&D_80000500); - func_8008AE70(0); + func_80080180(&D_80000500, 0x25800, 0x00010001); + func_800805E0(0); + func_8008FE60(&D_80000500); + func_8008AE70(0); } UNK_RET func_800801EC(void) { - func_80080150((void*)0x80000400, &D_80000500); - func_80080150(&D_80025D00, (int*)func_80080060); - func_80080150(&D_80208EA0, (UNK_PTR)(0x80000000 + D_80000318)); + func_80080150((void*)0x80000400, &D_80000500); + func_80080150(&D_80025D00, (int*)func_80080060); + func_80080150(&D_80208EA0, (UNK_PTR)(0x80000000 + D_80000318)); } UNK_RET func_80080250(void) { - UNK_PTR v0; - UNK_PTR v1; - UNK_PTR t7; - UNK_TYPE sp88; - UNK_TYPE sp84; - UNK_TYPE sp80; - UNK_TYPE sp76; - UNK_TYPE sp72; - UNK_TYPE sp68; - UNK_TYPE sp64; - UNK_TYPE sp60; - UNK_TYPE sp56; - UNK_TYPE sp52; - UNK_TYPE sp48; - UNK_TYPE sp44; - UNK_PTR sp40; - - func_8008F240(&sp48, &sp44, 1); - - v1 = &D_00B3C000; - t7 = &D_00C7A4E0; - sp40 = D_80096B50; - *(int*)sp40 = 0; - - func_80080C04(&sp72, (UNK_FUN_ARG)func_800A5AC0, v1, (u32)t7 - (u32)v1, 0, &sp48, 0); - func_8008019C(); - func_800801EC(); - func_80087ED0(&sp48, 0, 1); - - D_80096B50 = sp40; - - func_80080150(&D_801E3FA0, &D_80208EA0); + UNK_PTR v0; + UNK_PTR v1; + UNK_PTR t7; + UNK_TYPE sp88; + UNK_TYPE sp84; + UNK_TYPE sp80; + UNK_TYPE sp76; + UNK_TYPE sp72; + UNK_TYPE sp68; + UNK_TYPE sp64; + UNK_TYPE sp60; + UNK_TYPE sp56; + UNK_TYPE sp52; + UNK_TYPE sp48; + UNK_TYPE sp44; + UNK_PTR sp40; + + func_8008F240(&sp48, &sp44, 1); + + v1 = &D_00B3C000; + t7 = &D_00C7A4E0; + sp40 = D_80096B50; + *(int*)sp40 = 0; + + func_80080C04(&sp72, (UNK_FUN_ARG)func_800A5AC0, v1, (u32)t7 - (u32)v1, 0, &sp48, 0); + func_8008019C(); + func_800801EC(); + func_80087ED0(&sp48, 0, 1); + + D_80096B50 = sp40; + + func_80080150(&D_801E3FA0, &D_80208EA0); } UNK_RET func_80080300(UNK_TYPE a0) { - func_80085320(&D_8009A670, &D_8009A170, &D_8009A670_, 0, 256, &D_800981A0); - func_80081754(&D_80099EF0, &D_8009A670, 18, 1); - func_80080D0C(); - func_80080250(); - func_80174BF0(a0); - func_80080E00(); + func_80085320(&D_8009A670, &D_8009A170, &D_8009A670_, 0, 256, &D_800981A0); + func_80081754(&D_80099EF0, &D_8009A670, 18, 1); + func_80080D0C(); + func_80080250(); + func_80174BF0(a0); + func_80080E00(); } void func_8008038C(void) { - u32 i; - func_800952A0(254); - - D_80096B2C = 66; - D_80096B30 = 1.0; - D_80096B34 = 1.0; - - switch (osTvType) { - case 1: - D_8009B290 = 2; - for (i = 0; i < 20; i++) { - D_800980E0[i] = D_8009B240[i]; - } - D_80096B34 = D_800981B0; - break; - case 2: - D_8009B290 = 30; - for (i = 0; i < 20; i++) { - D_80098010[i] = D_8009B240[i]; - } - D_80096B34 = D_800981B0; - break; - case 0: - D_8009B290 = 44; - for (i = 0; i < 20; i++) { - D_80097FC0[i] = D_8009B240[i]; - } - break; - } - - D_80096B20 = 1; + u32 i; + func_800952A0(254); + + D_80096B2C = 66; + D_80096B30 = 1.0; + D_80096B34 = 1.0; + + switch (osTvType) { + case 1: + D_8009B290 = 2; + for (i = 0; i < 20; i++) { + D_800980E0[i] = D_8009B240[i]; + } + D_80096B34 = D_800981B0; + break; + case 2: + D_8009B290 = 30; + for (i = 0; i < 20; i++) { + D_80098010[i] = D_8009B240[i]; + } + D_80096B34 = D_800981B0; + break; + case 0: + D_8009B290 = 44; + for (i = 0; i < 20; i++) { + D_80097FC0[i] = D_8009B240[i]; + } + break; + } + + D_80096B20 = 1; } void func_80080514(UNK_TYPE a0) { - func_8008038C(); - func_8008C020(150, &D_8009B228, &D_8009B160, 50); - func_80085320(&D_8009B140, &D_8009A840, &D_8009B140_, 0, 1024, &D_800981A8); - func_80089E40(&D_8009A690, 3, func_80080300, a0, &D_8009B140, 12); - func_800957B0(&D_8009A690); - func_8008FC00(0, 0); - - while(1); + func_8008038C(); + func_8008C020(150, &D_8009B228, &D_8009B160, 50); + func_80085320(&D_8009B140, &D_8009A840, &D_8009B140_, 0, 1024, &D_800981A8); + func_80089E40(&D_8009A690, 3, func_80080300, a0, &D_8009B140, 12); + func_800957B0(&D_8009A690); + func_8008FC00(0, 0); + + while(1); } diff --git a/src/boot/boot_0x800805E0.c b/src/boot/boot_0x800805E0.c index b2eba7ef9a..2b5bfa8930 100644 --- a/src/boot/boot_0x800805E0.c +++ b/src/boot/boot_0x800805E0.c @@ -2,54 +2,54 @@ #include UNK_RET func_800805E0(UNK_TYPE a0) { - if (a0 != 0) { - switch (osTvType) { - case 2: - func_8008B650(&D_80098010); - break; - case 0: - func_8008B650(&D_80097590); - break; - case 1: - default: - func_8008B650(&D_80097FC0); - break; - } - - if (D_80096B2C != 0) { - func_80092100(D_80096B2C); - } - - if (D_80096B34 != 1) { - func_80095900(1); - } - } else { - func_8008B650(&D_8009B240); - - if (D_80096B28 != 0) { - func_80087E00(D_80096B28); - } - - if (D_80096B2C != 0) { - func_80092100(D_80096B2C); - } - - if (D_80096B30 != 1) { - func_80095950(D_80096B30); - } - - if (D_80096B34 != 1) { - func_80095900(D_80096B34); - } - } - - *D_80096B24 = a0; + if (a0 != 0) { + switch (osTvType) { + case 2: + func_8008B650(&D_80098010); + break; + case 0: + func_8008B650(&D_80097590); + break; + case 1: + default: + func_8008B650(&D_80097FC0); + break; + } + + if (D_80096B2C != 0) { + func_80092100(D_80096B2C); + } + + if (D_80096B34 != 1) { + func_80095900(1); + } + } else { + func_8008B650(&D_8009B240); + + if (D_80096B28 != 0) { + func_80087E00(D_80096B28); + } + + if (D_80096B2C != 0) { + func_80092100(D_80096B2C); + } + + if (D_80096B30 != 1) { + func_80095950(D_80096B30); + } + + if (D_80096B34 != 1) { + func_80095900(D_80096B34); + } + } + + *D_80096B24 = a0; } UNK_RET func_80080748(void) { - if (*D_80096B24 != 0) { - func_8008AE70(1); - } else { - func_8008AE70(0); - } + if (*D_80096B24 != 0) { + func_8008AE70(1); + } else { + func_8008AE70(0); + } } diff --git a/src/boot/boot_0x80081820.c b/src/boot/boot_0x80081820.c index 93e8b88c77..afafdc1799 100644 --- a/src/boot/boot_0x80081820.c +++ b/src/boot/boot_0x80081820.c @@ -6,20 +6,20 @@ void func_80081820(void) {} void func_80081828(void) {} void func_80081830(void) { - func_8008481C(80, 200, &D_80098280, (UNK_PTR)(*(u32*)0xA4040010)); - func_8008481C(40, 184, &D_80098290, &D_800994D0); - func_8008481C(56, 192, &D_800982A4, &D_800994DC); + func_8008481C(80, 200, &D_80098280, (UNK_PTR)(*(u32*)0xA4040010)); + func_8008481C(40, 184, &D_80098290, &D_800994D0); + func_8008481C(56, 192, &D_800982A4, &D_800994DC); } void func_8008189C(void) { - func_800819F0(&D_8009BE38, (void(*)(UNK_TYPE, UNK_TYPE))func_80081830, 0, 0); + func_800819F0(&D_8009BE38, (void(*)(UNK_TYPE, UNK_TYPE))func_80081830, 0, 0); } void func_800818D0(void) { - func_80081AD4(&D_8009BE38); + func_80081AD4(&D_8009BE38); } void func_800818F4(void) { - D_8009BE30 = *(u32*)0xA02FB1F4; - D_8009BE34 = *(u32*)0xA02FE1C0; + D_8009BE30 = *(u32*)0xA02FB1F4; + D_8009BE34 = *(u32*)0xA02FE1C0; } diff --git a/src/boot/boot_0x80085320.c b/src/boot/boot_0x80085320.c index 08fff2fe44..fe15167f45 100644 --- a/src/boot/boot_0x80085320.c +++ b/src/boot/boot_0x80085320.c @@ -2,103 +2,103 @@ #include void func_80085320(struct s80085320* a0, UNK_PTR a1, UNK_PTR a2, UNK_TYPE a3, UNK_TYPE sp16, UNK_PTR sp20) { - UNK_TYPE* i; - struct s80085320* v0; - - if (a0 == NULL) { - g_s80085320_ListHead = NULL; - return; - } - - a0->unk8 = a1; - a0->unk12 = a2; - a0->unk16 = a3; - a0->unk20 = sp16; - a0->unk24 = sp20; - - v0 = g_s80085320_ListHead; - while (v0 != NULL) { - if (v0 == a0) return; - v0 = v0->next; - } - - a0->prev = g_s80085320_ListTail; - a0->next = NULL; - - if (g_s80085320_ListTail != NULL) { - g_s80085320_ListTail->next = a0; - } - - g_s80085320_ListTail = a0; - - if (g_s80085320_ListHead == NULL) { - g_s80085320_ListHead = a0; - } - - if (a0->unk20 != -1) { - for (i = a0->unk8; i < a0->unk12; i++) { - *i = a0->unk16; - } - } + UNK_TYPE* i; + struct s80085320* v0; + + if (a0 == NULL) { + g_s80085320_ListHead = NULL; + return; + } + + a0->unk8 = a1; + a0->unk12 = a2; + a0->unk16 = a3; + a0->unk20 = sp16; + a0->unk24 = sp20; + + v0 = g_s80085320_ListHead; + while (v0 != NULL) { + if (v0 == a0) return; + v0 = v0->next; + } + + a0->prev = g_s80085320_ListTail; + a0->next = NULL; + + if (g_s80085320_ListTail != NULL) { + g_s80085320_ListTail->next = a0; + } + + g_s80085320_ListTail = a0; + + if (g_s80085320_ListHead == NULL) { + g_s80085320_ListHead = a0; + } + + if (a0->unk20 != -1) { + for (i = a0->unk8; i < a0->unk12; i++) { + *i = a0->unk16; + } + } } UNK_RET func_800853F8(struct s80085320* a0) { - if (a0->prev == NULL) { - if (g_s80085320_ListHead == a0) { - g_s80085320_ListHead = a0->next; - } - } else { - a0->prev->next = a0->next; - } - - if (a0->next == NULL) { - if (g_s80085320_ListTail == a0) { - g_s80085320_ListTail = a0->prev; - } - } + if (a0->prev == NULL) { + if (g_s80085320_ListHead == a0) { + g_s80085320_ListHead = a0->next; + } + } else { + a0->prev->next = a0->next; + } + + if (a0->next == NULL) { + if (g_s80085320_ListTail == a0) { + g_s80085320_ListTail = a0->prev; + } + } } UNK_TYPE func_80085468(struct s80085320* a0) { - UNK_TYPE* v1 = a0->unk8; - UNK_TYPE* a1 = a0->unk12; - UNK_TYPE* v0 = v1; - u32 x; // ptr_diff - - while (v0 < a1) { - if (*v0++ != a0->unk16) break; - a1 = (UNK_TYPE*)((u32)v0 - (u32)v1); - } - - x = v0 - v1; - - if (x == 0) { - return 2; - } - - if ((x < a0->unk20) && (a0->unk20 != -1)) { - return 1; - } - - return 0; + UNK_TYPE* v1 = a0->unk8; + UNK_TYPE* a1 = a0->unk12; + UNK_TYPE* v0 = v1; + u32 x; // ptr_diff + + while (v0 < a1) { + if (*v0++ != a0->unk16) break; + a1 = (UNK_TYPE*)((u32)v0 - (u32)v1); + } + + x = v0 - v1; + + if (x == 0) { + return 2; + } + + if ((x < a0->unk20) && (a0->unk20 != -1)) { + return 1; + } + + return 0; } UNK_TYPE func_800854E0(UNK_ARGS) { - struct s80085320* s0 = g_s80085320_ListHead; - UNK_TYPE ret = 0; - while (s0 != NULL) { - if (func_80085468(s0) != 0) { - ret = 1; - } - s0 = s0->next; - } - - return ret; + struct s80085320* s0 = g_s80085320_ListHead; + UNK_TYPE ret = 0; + while (s0 != NULL) { + if (func_80085468(s0) != 0) { + ret = 1; + } + s0 = s0->next; + } + + return ret; } UNK_RET func_80085538(struct s80085320* a0) { - if (a0 == NULL) { - func_800854E0(); - } else { - func_80085468(a0); - } + if (a0 == NULL) { + func_800854E0(); + } else { + func_80085468(a0); + } } diff --git a/src/boot/boot_0x80087830.c b/src/boot/boot_0x80087830.c index 6569fdfff7..d64ad60504 100644 --- a/src/boot/boot_0x80087830.c +++ b/src/boot/boot_0x80087830.c @@ -2,25 +2,25 @@ #include UNK_TYPE func_80087830(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) { - return func_8008F208(a0, a1) + a2; + return func_8008F208(a0, a1) + a2; } UNK_TYPE func_80087854(u8* a0, UNK_TYPE a1, UNK_PTR a2) { - UNK_TYPE v0 = func_8008E050(func_80087830, a0, a1, a2); - - if (v0 >= 0) { - a0[v0] = 0; - } - - return v0; + UNK_TYPE v0 = func_8008E050(func_80087830, a0, a1, a2); + + if (v0 >= 0) { + a0[v0] = 0; + } + + return v0; } UNK_TYPE func_800878A4(u8* a0, UNK_TYPE a1, UNK_TYPE a2, UNK_TYPE a3) { - UNK_TYPE v0 = func_8008E050(func_80087830, a0, a1, &a2); - - if (v0 >= 0) { - a0[v0] = 0; - } - - return v0; + UNK_TYPE v0 = func_8008E050(func_80087830, a0, a1, &a2); + + if (v0 >= 0) { + a0[v0] = 0; + } + + return v0; } diff --git a/src/boot/boot_0x80087900.c b/src/boot/boot_0x80087900.c index 7ad35ba096..007d7442c4 100644 --- a/src/boot/boot_0x80087900.c +++ b/src/boot/boot_0x80087900.c @@ -2,29 +2,29 @@ #include UNK_RET func_80087900(UNK_PTR a0, UNK_TYPE a1, UNK_PTR a2) { - func_8008E050((UNK_TYPE(*)(UNK_TYPE, UNK_TYPE, UNK_TYPE))(*(u32*)a0), a0, a1, a2); + func_8008E050((UNK_TYPE(*)(UNK_TYPE, UNK_TYPE, UNK_TYPE))(*(u32*)a0), a0, a1, a2); } UNK_RET func_80087934(UNK_PTR a0, UNK_TYPE a1, UNK_PTR a2, UNK_TYPE a3) { - func_80087900(a0, a1, &a2); + func_80087900(a0, a1, &a2); } UNK_RET func_80087960(u64 a0) { - + } UNK_RET func_800879CC(u32 a0) { - func_80087960(func_800888A8(func_800889A8(a0, 3), 64)); + func_80087960(func_800888A8(func_800889A8(a0, 3), 64)); } UNK_RET func_80087A1C(u32 a0) { - func_80087960(func_800888A8(func_800889A8(a0, 3000), 64)); + func_80087960(func_800888A8(func_800889A8(a0, 3000), 64)); } UNK_RET func_80087A6C(u32 a0) { - func_80087960(func_800888A8(func_800889A8(a0, 0x02CB4178), 1000)); + func_80087960(func_800888A8(func_800889A8(a0, 0x02CB4178), 1000)); } UNK_RET func_80087AC0(u32 a0) { - func_80087960(func_800889A8(a0, 0x02CB4178)); + func_80087960(func_800889A8(a0, 0x02CB4178)); } diff --git a/src/boot/boot_0x80087E00.c b/src/boot/boot_0x80087E00.c index 3413afb3d6..a239021707 100644 --- a/src/boot/boot_0x80087E00.c +++ b/src/boot/boot_0x80087E00.c @@ -2,5 +2,5 @@ #include void func_80087E00(u32 a0) { - D_8009817C = a0; + D_8009817C = a0; } diff --git a/src/boot/boot_0x8008A660.c.ignore b/src/boot/boot_0x8008A660.c.ignore index ed8b5a5ecd..642b1c806e 100644 --- a/src/boot/boot_0x8008A660.c.ignore +++ b/src/boot/boot_0x8008A660.c.ignore @@ -2,63 +2,63 @@ #include void func_8008A660(void) { - D_8009D134 = 7; - D_8009D135 = *(u32*)0xA4600014; - D_8009D138 = *(u32*)0xA4600018; - D_8009D136 = *(u32*)0xA460001C; - D_8009D137 = *(u32*)0xA4600020; - D_8009D1AC = 7; - D_8009D1AD = *(u32*)0xA4600024; - D_8009D1B0 = *(u32*)0xA4600028; - D_8009D1AE = *(u32*)0xA460002C; - D_8009D1AF = *(u32*)0xA4600030; + D_8009D134 = 7; + D_8009D135 = *(u32*)0xA4600014; + D_8009D138 = *(u32*)0xA4600018; + D_8009D136 = *(u32*)0xA460001C; + D_8009D137 = *(u32*)0xA4600020; + D_8009D1AC = 7; + D_8009D1AD = *(u32*)0xA4600024; + D_8009D1B0 = *(u32*)0xA4600028; + D_8009D1AE = *(u32*)0xA460002C; + D_8009D1AF = *(u32*)0xA4600030; } u64 D_80097E50; // this has to be defined in this file for func_8008A6FC to match void func_8008A6FC(void) { - UNK_TYPE sp44; - - D_8009CF70 = 1; - - func_8008A5D0(func_8008A5C0() | 0x20000000); - func_80092CE0(0x20000800); - func_80096820(0x04900000); - - while (func_8008AEE0(0x1FC007FC, &sp44) != 0); - while (func_80095220(0x1FC007FC, sp44 | 8) != 0); - - *(struct s8008A6FC*)0x80000000 = *((struct s8008A6FC*)__osExceptionPreamble); - *(struct s8008A6FC*)0x80000080 = *((struct s8008A6FC*)__osExceptionPreamble); - *(struct s8008A6FC*)0x80000100 = *((struct s8008A6FC*)__osExceptionPreamble); - *(struct s8008A6FC*)0x80000180 = *((struct s8008A6FC*)__osExceptionPreamble); - - func_8008A5E0(0x80000000, 400); - func_8008F270(0x80000000, 400); - func_8008A660(); - func_8008EDE0(); - func_80093C00(); - D_80097E50 = func_800888A8(func_800889A8(D_80097E50, 3), 4); - - if (D_8000030C == 0) { - func_80089630(&D_8000031C, 64); - } - - if (osTvType == 0) { - D_80097E58 = 0x02F5B2D2; - } else if (osTvType == 2) { - D_80097E58 = 0x02E6025C; - } else { - D_80097E58 = 0x02E6D354; - } - - if((func_80093D90() & 0x1000) != 0) { - while(1); - } - - *(u32*)0xA4500008 = 1; - *(u32*)0xA4500010 = 16383; - *(u32*)0xA4500014 = 15; + UNK_TYPE sp44; + + D_8009CF70 = 1; + + func_8008A5D0(func_8008A5C0() | 0x20000000); + func_80092CE0(0x20000800); + func_80096820(0x04900000); + + while (func_8008AEE0(0x1FC007FC, &sp44) != 0); + while (func_80095220(0x1FC007FC, sp44 | 8) != 0); + + *(struct s8008A6FC*)0x80000000 = *((struct s8008A6FC*)__osExceptionPreamble); + *(struct s8008A6FC*)0x80000080 = *((struct s8008A6FC*)__osExceptionPreamble); + *(struct s8008A6FC*)0x80000100 = *((struct s8008A6FC*)__osExceptionPreamble); + *(struct s8008A6FC*)0x80000180 = *((struct s8008A6FC*)__osExceptionPreamble); + + func_8008A5E0(0x80000000, 400); + func_8008F270(0x80000000, 400); + func_8008A660(); + func_8008EDE0(); + func_80093C00(); + D_80097E50 = func_800888A8(func_800889A8(D_80097E50, 3), 4); + + if (D_8000030C == 0) { + func_80089630(&D_8000031C, 64); + } + + if (osTvType == 0) { + D_80097E58 = 0x02F5B2D2; + } else if (osTvType == 2) { + D_80097E58 = 0x02E6025C; + } else { + D_80097E58 = 0x02E6D354; + } + + if((func_80093D90() & 0x1000) != 0) { + while(1); + } + + *(u32*)0xA4500008 = 1; + *(u32*)0xA4500010 = 16383; + *(u32*)0xA4500014 = 15; } void func_8008A9A8(void) {} diff --git a/src/boot/boot_0x8008ACE0.c b/src/boot/boot_0x8008ACE0.c index a89b7f5e3d..8af65f4d6d 100644 --- a/src/boot/boot_0x8008ACE0.c +++ b/src/boot/boot_0x8008ACE0.c @@ -2,18 +2,18 @@ #include s32 __osSpRawStartDma(s32 direction, u32 devAddr , void* dramAddr, u32 size) { - if (__osSpDeviceBusy() != 0) { - return -1; - } - - *(vu32*)0xA4040000 = devAddr; - *(vu32*)0xA4040004 = osVirtualToPhysical(dramAddr); - - if (direction == 0) { - *(vu32*)0xA404000C = size - 1; - } else { - *(vu32*)0xA4040008 = size - 1; - } - - return 0; + if (__osSpDeviceBusy() != 0) { + return -1; + } + + *(vu32*)0xA4040000 = devAddr; + *(vu32*)0xA4040004 = osVirtualToPhysical(dramAddr); + + if (direction == 0) { + *(vu32*)0xA404000C = size - 1; + } else { + *(vu32*)0xA4040008 = size - 1; + } + + return 0; } diff --git a/src/boot/boot_0x8008D350.c.ignore b/src/boot/boot_0x8008D350.c.ignore index 5be18b9c84..348b8b3fbe 100644 --- a/src/boot/boot_0x8008D350.c.ignore +++ b/src/boot/boot_0x8008D350.c.ignore @@ -2,29 +2,29 @@ #include UNK_TYPE func_8008D350(void) { - u32* sp12; - u32 sp8; - u32 sp4; - u32 sp0; - - sp8 = 0x400000; - - do { - sp12 = (u32*)(sp8 + 0xA0000000); - sp4 = *(u32*)(0xA0000000 + sp8); - sp0 = *(u32*)(0xA00FFFFC + sp8); - *(u32*)(0xA0000000 + sp8) = *(u32*)(0xA0000000 + sp8) ^ 0xFFFFFFFF; - sp12[0x000FFFFC/4] = sp12[0x000FFFFC/4] ^ 0xFFFFFFFF; - - if ((sp12[0] != (sp4 ^ 0xFFFFFFFF)) || - (sp12[0x000FFFFC/4] != (sp0 ^ 0xFFFFFFFF))) { - return sp8; - } - - *sp12 = sp4; - sp12[0x000FFFFC/4] = sp0; - sp8 = sp8 + 0x100000; - } while(sp8 < 0x800000); - - return sp8; + u32* sp12; + u32 sp8; + u32 sp4; + u32 sp0; + + sp8 = 0x400000; + + do { + sp12 = (u32*)(sp8 + 0xA0000000); + sp4 = *(u32*)(0xA0000000 + sp8); + sp0 = *(u32*)(0xA00FFFFC + sp8); + *(u32*)(0xA0000000 + sp8) = *(u32*)(0xA0000000 + sp8) ^ 0xFFFFFFFF; + sp12[0x000FFFFC/4] = sp12[0x000FFFFC/4] ^ 0xFFFFFFFF; + + if ((sp12[0] != (sp4 ^ 0xFFFFFFFF)) || + (sp12[0x000FFFFC/4] != (sp0 ^ 0xFFFFFFFF))) { + return sp8; + } + + *sp12 = sp4; + sp12[0x000FFFFC/4] = sp0; + sp8 = sp8 + 0x100000; + } while(sp8 < 0x800000); + + return sp8; } diff --git a/src/boot/boot_0x80092920.c b/src/boot/boot_0x80092920.c index f450b70874..f394644110 100644 --- a/src/boot/boot_0x80092920.c +++ b/src/boot/boot_0x80092920.c @@ -2,60 +2,60 @@ #include struct s80092920* func_80092920(void) { - u32 v0; - u32 temp; - u32 temp2; - u32 temp3; - u32 temp4; - UNK_TYPE func_ret; - - func_8008C1E0(); - - if (D_800980D0 == 0) { - func_8008C224(); - return &D_8009E610; - } - - D_800980D0_ = 0; - - D_8009E610.unk4 = 0; - D_8009E610.unk12 = 0xB0000000; - D_8009E610.unk9 = 0; - D_8009E610.unk16 = 0; - - func_80089630(&D_8009E624, 96); - - while ((*(vu32*)0xA4600010) & 0x3); - - temp = *(vu32*)0xA4600014; - temp2 = *(vu32*)0xA460001C; - temp3 = *(vu32*)0xA4600020; - temp4 = *(vu32*)0xA4600018; - - *(vu32*)0xA4600014 = 255; - *(vu32*)0xA460001C = 0; - *(vu32*)0xA4600020 = 3; - *(vu32*)0xA4600018 = 255; - - v0 = *(u32*)(D_8009E610.unk12 | 0xA0000000); - D_8009E610.unk6 = (v0 >> 16) & 0xF; - D_8009E610.unk7 = (v0 >> 20) & 0xF; - D_8009E610.unk8 = v0 >> 8; - D_8009E610.unk5 = v0; - - *(vu32*)0xA4600014 = temp; - *(vu32*)0xA460001C = temp2; - *(vu32*)0xA4600020 = temp3; - *(vu32*)0xA4600018 = temp4; - - func_ret = func_80091A60(); - - D_8009E610.unk0 = D_80097E8C; - D_80097E8C = &D_8009E610; - - func_80091AD0(func_ret); - - func_8008C224(); - - return &D_8009E610; + u32 v0; + u32 temp; + u32 temp2; + u32 temp3; + u32 temp4; + UNK_TYPE func_ret; + + func_8008C1E0(); + + if (D_800980D0 == 0) { + func_8008C224(); + return &D_8009E610; + } + + D_800980D0_ = 0; + + D_8009E610.unk4 = 0; + D_8009E610.unk12 = 0xB0000000; + D_8009E610.unk9 = 0; + D_8009E610.unk16 = 0; + + func_80089630(&D_8009E624, 96); + + while ((*(vu32*)0xA4600010) & 0x3); + + temp = *(vu32*)0xA4600014; + temp2 = *(vu32*)0xA460001C; + temp3 = *(vu32*)0xA4600020; + temp4 = *(vu32*)0xA4600018; + + *(vu32*)0xA4600014 = 255; + *(vu32*)0xA460001C = 0; + *(vu32*)0xA4600020 = 3; + *(vu32*)0xA4600018 = 255; + + v0 = *(u32*)(D_8009E610.unk12 | 0xA0000000); + D_8009E610.unk6 = (v0 >> 16) & 0xF; + D_8009E610.unk7 = (v0 >> 20) & 0xF; + D_8009E610.unk8 = v0 >> 8; + D_8009E610.unk5 = v0; + + *(vu32*)0xA4600014 = temp; + *(vu32*)0xA460001C = temp2; + *(vu32*)0xA4600020 = temp3; + *(vu32*)0xA4600018 = temp4; + + func_ret = func_80091A60(); + + D_8009E610.unk0 = D_80097E8C; + D_80097E8C = &D_8009E610; + + func_80091AD0(func_ret); + + func_8008C224(); + + return &D_8009E610; } diff --git a/src/boot/boot_0x80095900.c b/src/boot/boot_0x80095900.c index 4737503f27..42bd81661d 100644 --- a/src/boot/boot_0x80095900.c +++ b/src/boot/boot_0x80095900.c @@ -2,13 +2,13 @@ #include void func_80095900(f32 f12) { - u32 oldInt; - - oldInt = __osDisableInt(); - - *((f32*)__osViNext + 36 / 4) = f12; - - *(u16*)__osViNext |= 0x4; - - __osRestoreInt(oldInt); + u32 oldInt; + + oldInt = __osDisableInt(); + + *((f32*)__osViNext + 36 / 4) = f12; + + *(u16*)__osViNext |= 0x4; + + __osRestoreInt(oldInt); } diff --git a/src/boot/boot_0x800968B0.c b/src/boot/boot_0x800968B0.c index b21f40ecc4..73ab73177a 100644 --- a/src/boot/boot_0x800968B0.c +++ b/src/boot/boot_0x800968B0.c @@ -2,14 +2,14 @@ #include u32 func_800968B0(const u8* a0, const u8* a1) { - u8 v0; - u8 v1; - do { - v0 = *a0++; - v1 = *a1++; - if (v0 != v1) { - return v0 - v1; - } - } while (v0 != 0); - return 0; + u8 v0; + u8 v1; + do { + v0 = *a0++; + v1 = *a1++; + if (v0 != v1) { + return v0 - v1; + } + } while (v0 != 0); + return 0; } diff --git a/src/code/code_0x800A5AC0.c b/src/code/code_0x800A5AC0.c index ff766e42c3..19232ec3dc 100644 --- a/src/code/code_0x800A5AC0.c +++ b/src/code/code_0x800A5AC0.c @@ -2,51 +2,51 @@ #include UNK_RET func_800A5AC0(void* a0, UNK_TYPE a1) { - struct s800A5AC0* s0 = (struct s800A5AC0*)a0; - s0->unk278 = ((s0->unk28 >> 8) & 0xFF) | 0x300; - s0->unk28 = (s0->unk28 & 0xFF) - 9; - func_800FFADC(s0, &D_801ADEAC); - func_800B3BA4(&s0->unk188, 0, (void*)&func_800B3FC0, 0x41400000); - func_800E1374(a1, &s0->unk328, s0, &D_801ADE80); - func_800E7DF8(s0, &s0->unk328); - s0->unk182 = 255; - s0->unk324 = func_800A5B98; + struct s800A5AC0* s0 = (struct s800A5AC0*)a0; + s0->unk278 = ((s0->unk28 >> 8) & 0xFF) | 0x300; + s0->unk28 = (s0->unk28 & 0xFF) - 9; + func_800FFADC(s0, &D_801ADEAC); + func_800B3BA4(&s0->unk188, 0, (void*)&func_800B3FC0, 0x41400000); + func_800E1374(a1, &s0->unk328, s0, &D_801ADE80); + func_800E7DF8(s0, &s0->unk328); + s0->unk182 = 255; + s0->unk324 = func_800A5B98; } UNK_RET func_800A5B6C(struct s800A5AC0* a0, UNK_TYPE a1) { - func_800E11EC(a1, &a0->unk328); + func_800E11EC(a1, &a0->unk328); } UNK_RET func_800A5B98(struct s800A5AC0* a0, UNK_TYPE a1) { - s16 v0; - s32 v1; - if (func_800B84D0(a0, a1) != 0) { - a0->unk324 = func_800A5C28; - } else { - v0 = a0->unk146 - a0->unk190; - if (v0 < 0) { - v1 = -v0; - } else { - v1 = v0; - } - if ((v1 < 10240) || ((a0->unk28 == 1) && (v1 > 22528))) { - func_800B863C(a0, a1); - } - } + s16 v0; + s32 v1; + if (func_800B84D0(a0, a1) != 0) { + a0->unk324 = func_800A5C28; + } else { + v0 = a0->unk146 - a0->unk190; + if (v0 < 0) { + v1 = -v0; + } else { + v1 = v0; + } + if ((v1 < 10240) || ((a0->unk28 == 1) && (v1 > 22528))) { + func_800B863C(a0, a1); + } + } } UNK_RET func_800A5C28(struct s800A5AC0* a0, UNK_TYPE a1 /* unused */ ) { - if (func_800B867C(a0) != 0) { - a0->unk324 = func_800A5B98; - } + if (func_800B867C(a0) != 0) { + a0->unk324 = func_800A5B98; + } } UNK_RET func_800A5C60(struct s800A5AC0* a0, UNK_TYPE a1) { - (a0->unk324)(a0, a1); - func_800B675C(a0, 0x42340000); - func_800E2928(a1, a1 + 0x18884, &a0->unk328); + (a0->unk324)(a0, a1); + func_800B675C(a0, 0x42340000); + func_800E2928(a1, a1 + 0x18884, &a0->unk328); } UNK_RET func_800A5CB8(struct s800A5AC0* a0, UNK_TYPE a1) { - func_800BDFC0(a1, D_801ADEB0[a0->unk28], a1, a0); + func_800BDFC0(a1, D_801ADEB0[a0->unk28], a1, a0); } diff --git a/src/code/code_0x800BF9A0.c b/src/code/code_0x800BF9A0.c index b5c62cb155..de964f8b8d 100644 --- a/src/code/code_0x800BF9A0.c +++ b/src/code/code_0x800BF9A0.c @@ -2,31 +2,31 @@ #include UNK_RET func_800BF9A0(UNK_TYPE a0, UNK_TYPE a1) { - s32 i; - s800BF9A0_s* s0; - - func_8008439C(-2, 0); - func_800847CC(&D_801DCBB0, D_801B4610); - func_800847CC(&D_801DCBC4); - - for (i = 0, s0 = D_801AEFD0; i < D_801B4610; i++, s0++) { - if (s0->unk16 == 0) continue; - func_800847CC(&D_801DCBE4, i, s0->unk16, s0->unk16 + (s0->unk12 - s0->unk8), s0->unk30, &D_801DCBFC); - } + s32 i; + s800BF9A0_s* s0; + + func_8008439C(-2, 0); + func_800847CC(&D_801DCBB0, D_801B4610); + func_800847CC(&D_801DCBC4); + + for (i = 0, s0 = D_801AEFD0; i < D_801B4610; i++, s0++) { + if (s0->unk16 == 0) continue; + func_800847CC(&D_801DCBE4, i, s0->unk16, s0->unk16 + (s0->unk12 - s0->unk8), s0->unk30, &D_801DCBFC); + } } UNK_TYPE func_800BFA78(UNK_TYPE a0, UNK_TYPE a1) { - + } UNK_RET func_800BFAE8(UNK_ARGS) { - D_801B4610 = 690; - func_800819F0(&D_801ED930, func_800BF9A0, 0, 0); - func_80081BCC(&D_801ED940, func_800BFA78, 0); + D_801B4610 = 690; + func_800819F0(&D_801ED930, func_800BF9A0, 0, 0); + func_80081BCC(&D_801ED940, func_800BFA78, 0); } UNK_RET func_800BFB40(UNK_ARGS) { - func_80081AD4(&D_801ED930); - func_80081CA4(&D_801ED940); - D_801B4610 = 0; + func_80081AD4(&D_801ED930); + func_80081CA4(&D_801ED940); + D_801B4610 = 0; } diff --git a/src/code/code_0x800CAAD0.c b/src/code/code_0x800CAAD0.c index d79735bb44..e5fc11c216 100644 --- a/src/code/code_0x800CAAD0.c +++ b/src/code/code_0x800CAAD0.c @@ -2,98 +2,98 @@ #include UNK_RET func_800CAAD0(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) { - UNK_TYPE sp208; - UNK_TYPE sp144; - UNK_TYPE sp80; - UNK_TYPE sp68; - UNK_TYPE sp56; - UNK_TYPE sp36; - - s800CAAD0* v1; - - if (func_800C6024(a1) == 0) return; - - v1 = (s800CAAD0*)(a0 + a1 * 100); - - func_80139894(&sp208, v1->unk104, v1->unk108, v1->unk112, v1->unk116, v1->unk118, - v1->unk120, v1->unk124, v1->unk128, v1->unk132); - - if (func_80139188(&sp208, &sp144) == 2) return; - - func_80139894(&sp80, v1->unk136, v1->unk140, v1->unk144, v1->unk148, v1->unk150, - v1->unk152, v1->unk156, v1->unk160, v1->unk164); - - func_80138C88(&sp144, (UNK_PTR)(a2 + 36), &sp36); - func_80138C88(&sp80, &sp56, &sp68); - - v1->unk0 = *(UNK_TYPE*)((u8*)sp36 + 0); - v1->unk4 = *(UNK_TYPE*)((u8*)sp36 + 4); - v1->unk8 = *(UNK_TYPE*)((u8*)sp36 + 8); + UNK_TYPE sp208; + UNK_TYPE sp144; + UNK_TYPE sp80; + UNK_TYPE sp68; + UNK_TYPE sp56; + UNK_TYPE sp36; + + s800CAAD0* v1; + + if (func_800C6024(a1) == 0) return; + + v1 = (s800CAAD0*)(a0 + a1 * 100); + + func_80139894(&sp208, v1->unk104, v1->unk108, v1->unk112, v1->unk116, v1->unk118, + v1->unk120, v1->unk124, v1->unk128, v1->unk132); + + if (func_80139188(&sp208, &sp144) == 2) return; + + func_80139894(&sp80, v1->unk136, v1->unk140, v1->unk144, v1->unk148, v1->unk150, + v1->unk152, v1->unk156, v1->unk160, v1->unk164); + + func_80138C88(&sp144, (UNK_PTR)(a2 + 36), &sp36); + func_80138C88(&sp80, &sp56, &sp68); + + v1->unk0 = *(UNK_TYPE*)((u8*)sp36 + 0); + v1->unk4 = *(UNK_TYPE*)((u8*)sp36 + 4); + v1->unk8 = *(UNK_TYPE*)((u8*)sp36 + 8); } UNK_RET func_800CAC0C(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) { - UNK_TYPE v0; - s16 v1; - - if (func_800C6024(a0) == 0) return; - - v0 = a0 + a1 * 100; - - v1 = *(s16*)(v0 + 150) - *(s16*)(v0 + 118); - - if (*(s16*)a2 == 0) { - *(s16*)(a2 + 2772) += v1; - } - - *(s16*)(a2 + 190) += v1; - *(s16*)(a2 + 50) += v1; + UNK_TYPE v0; + s16 v1; + + if (func_800C6024(a0) == 0) return; + + v0 = a0 + a1 * 100; + + v1 = *(s16*)(v0 + 150) - *(s16*)(v0 + 118); + + if (*(s16*)a2 == 0) { + *(s16*)(a2 + 2772) += v1; + } + + *(s16*)(a2 + 190) += v1; + *(s16*)(a2 + 50) += v1; } UNK_RET func_800CACA0(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) { - UNK_TYPE sp28; - - if (func_800C6024(a2) == 0) return; - - sp28 = func_800C6248(a0, a2); - - if (sp28 == 0) return; - - func_800CAE88(sp28); - - if ((*(u32*)(a1 + 4) & 0x04000000) == 0x0400) { - func_800CAF24(sp28); - } - - if ((*(u32*)(a1 + 4) & 0x20000) == 0x20000) { - func_800CAF38(sp28); - } + UNK_TYPE sp28; + + if (func_800C6024(a2) == 0) return; + + sp28 = func_800C6248(a0, a2); + + if (sp28 == 0) return; + + func_800CAE88(sp28); + + if ((*(u32*)(a1 + 4) & 0x04000000) == 0x0400) { + func_800CAF24(sp28); + } + + if ((*(u32*)(a1 + 4) & 0x20000) == 0x20000) { + func_800CAF38(sp28); + } } UNK_TYPE func_800CAD2C(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) { - UNK_TYPE v1; - UNK_TYPE sp36 = 0; - - if (func_800C6024(a1) == 0) return; - - if (((*(u16*)(a0 + a1*2 + 5084) & 0x2) != 0) || - ((*(u16*)(a0 + a1*2 + 5084) & 0x1) == 0)) { - return 0; - } - - v1 = func_800C6248(a0, a1); - if (v1 == 0) { - return 0; - } - - if ((*(u32*)(v1 + 340) & 0x1) != 0) { - func_800CAAD0(a0, a1, a2); - sp36 = 1; - } - - if ((*(u32*)(v1 + 340) & 0x2) != 0) { - func_800CAC0C(a0, a1, a2); - sp36 = 1; - } - - return sp36; + UNK_TYPE v1; + UNK_TYPE sp36 = 0; + + if (func_800C6024(a1) == 0) return; + + if (((*(u16*)(a0 + a1*2 + 5084) & 0x2) != 0) || + ((*(u16*)(a0 + a1*2 + 5084) & 0x1) == 0)) { + return 0; + } + + v1 = func_800C6248(a0, a1); + if (v1 == 0) { + return 0; + } + + if ((*(u32*)(v1 + 340) & 0x1) != 0) { + func_800CAAD0(a0, a1, a2); + sp36 = 1; + } + + if ((*(u32*)(v1 + 340) & 0x2) != 0) { + func_800CAC0C(a0, a1, a2); + sp36 = 1; + } + + return sp36; } diff --git a/src/libultra/io/contquery.c b/src/libultra/io/contquery.c index e13ee774f3..5d520d1e4d 100644 --- a/src/libultra/io/contquery.c +++ b/src/libultra/io/contquery.c @@ -6,27 +6,27 @@ s32 osContStartQuery(OSMesgQueue* mq) { s32 ret; - - __osSiGetAccess(); - - if (__osContLastCmd != 0) { - __osPackRequestData(0); - __osSiRawStartDma(1, &__osContPifRam); - osRecvMesg(mq, NULL, 1); - } - - ret = __osSiRawStartDma(0, &__osContPifRam); - - __osContLastCmd = 0; - - __osSiRelAccess(); - - return ret; + + __osSiGetAccess(); + + if (__osContLastCmd != 0) { + __osPackRequestData(0); + __osSiRawStartDma(1, &__osContPifRam); + osRecvMesg(mq, NULL, 1); + } + + ret = __osSiRawStartDma(0, &__osContPifRam); + + __osContLastCmd = 0; + + __osSiRelAccess(); + + return ret; } void osContGetQuery(OSContStatus* data) { u8 pattern; - - __osContGetInitData(&pattern, data); + + __osContGetInitData(&pattern, data); } diff --git a/src/libultra/io/sirawread.c b/src/libultra/io/sirawread.c index d10fde5402..e30b55f81c 100644 --- a/src/libultra/io/sirawread.c +++ b/src/libultra/io/sirawread.c @@ -2,11 +2,11 @@ #include s32 __osSiRawReadIo(u32 devAddr, u32* data) { - if (__osSiDeviceBusy() != 0) { - return -1; - } - - *(u32*)(devAddr | 0xA0000000) = (u32)data; - - return 0; + if (__osSiDeviceBusy() != 0) { + return -1; + } + + *(u32*)(devAddr | 0xA0000000) = (u32)data; + + return 0; } diff --git a/src/libultra/io/spgetstat.c b/src/libultra/io/spgetstat.c index 23404da9f4..1a660b189c 100644 --- a/src/libultra/io/spgetstat.c +++ b/src/libultra/io/spgetstat.c @@ -2,5 +2,5 @@ #include u32 __osSpGetStatus() { - return *(vu32*)0xA4040010; + return *(vu32*)0xA4040010; } diff --git a/src/libultra/io/spsetstat.c b/src/libultra/io/spsetstat.c index 0aa2defb13..741b2114ed 100644 --- a/src/libultra/io/spsetstat.c +++ b/src/libultra/io/spsetstat.c @@ -2,5 +2,5 @@ #include void __osSpSetStatus(u32 data) { - *(vu32*)0xA4040010 = data; + *(vu32*)0xA4040010 = data; } diff --git a/src/libultra/io/sptask.c b/src/libultra/io/sptask.c index ac4101102a..a731089125 100644 --- a/src/libultra/io/sptask.c +++ b/src/libultra/io/sptask.c @@ -5,62 +5,62 @@ OSTask* _VirtualToPhysicalTask(OSTask* intp) { OSTask* tp = &tmp_task; - _bcopy((void*)intp, (void*)tp, sizeof(OSTask)); - if (tp->t.ucode) { - tp->t.ucode = (u64*)osVirtualToPhysical(tp->t.ucode); - } - if (tp->t.ucode_data) { - tp->t.ucode_data = (u64*)osVirtualToPhysical(tp->t.ucode_data); - } - if (tp->t.dram_stack) { - tp->t.dram_stack = (u64*)osVirtualToPhysical(tp->t.dram_stack); - } - if (tp->t.output_buff) { - tp->t.output_buff = (u64*)osVirtualToPhysical(tp->t.output_buff); - } - if (tp->t.output_buff_size) { - tp->t.output_buff_size = (u64*)osVirtualToPhysical(tp->t.output_buff_size); - } - if (tp->t.data_ptr) { - tp->t.data_ptr = (u64*)osVirtualToPhysical(tp->t.data_ptr); - } - if (tp->t.yield_data_ptr) { - tp->t.yield_data_ptr = (u64*)osVirtualToPhysical(tp->t.yield_data_ptr); - } - - return &tmp_task; + _bcopy((void*)intp, (void*)tp, sizeof(OSTask)); + if (tp->t.ucode) { + tp->t.ucode = (u64*)osVirtualToPhysical(tp->t.ucode); + } + if (tp->t.ucode_data) { + tp->t.ucode_data = (u64*)osVirtualToPhysical(tp->t.ucode_data); + } + if (tp->t.dram_stack) { + tp->t.dram_stack = (u64*)osVirtualToPhysical(tp->t.dram_stack); + } + if (tp->t.output_buff) { + tp->t.output_buff = (u64*)osVirtualToPhysical(tp->t.output_buff); + } + if (tp->t.output_buff_size) { + tp->t.output_buff_size = (u64*)osVirtualToPhysical(tp->t.output_buff_size); + } + if (tp->t.data_ptr) { + tp->t.data_ptr = (u64*)osVirtualToPhysical(tp->t.data_ptr); + } + if (tp->t.yield_data_ptr) { + tp->t.yield_data_ptr = (u64*)osVirtualToPhysical(tp->t.yield_data_ptr); + } + + return &tmp_task; } void osSpTaskLoad(OSTask* intp) { OSTask* tp; - - tp = _VirtualToPhysicalTask(intp); - - if ((tp->t.flags & 0x1) != 0) { - tp->t.ucode_data = tp->t.yield_data_ptr; - tp->t.ucode_data_size = tp->t.yield_data_size; - - intp->t.flags = intp->t.flags & 0xFFFFFFFE; - - if ((tp->t.flags & 0x4) != 0) { - tp->t.ucode = *(u64**)(((u32)intp->t.yield_data_ptr + 3068) | 0xA0000000); - } - } - - osWritebackDCache((void*)tp, sizeof(OSTask)); - - __osSpSetStatus(11008); - - while (__osSpSetPc(0x04001000) == -1); - while (__osSpRawStartDma(1, 0x04000FC0, (void*)tp, sizeof(OSTask)) == -1); - while (__osSpDeviceBusy()); - while (__osSpRawStartDma(1, 0x04001000, (void*)tp->t.ucode_boot, tp->t.ucode_boot_size) == -1); + + tp = _VirtualToPhysicalTask(intp); + + if ((tp->t.flags & 0x1) != 0) { + tp->t.ucode_data = tp->t.yield_data_ptr; + tp->t.ucode_data_size = tp->t.yield_data_size; + + intp->t.flags = intp->t.flags & 0xFFFFFFFE; + + if ((tp->t.flags & 0x4) != 0) { + tp->t.ucode = *(u64**)(((u32)intp->t.yield_data_ptr + 3068) | 0xA0000000); + } + } + + osWritebackDCache((void*)tp, sizeof(OSTask)); + + __osSpSetStatus(11008); + + while (__osSpSetPc(0x04001000) == -1); + while (__osSpRawStartDma(1, 0x04000FC0, (void*)tp, sizeof(OSTask)) == -1); + while (__osSpDeviceBusy()); + while (__osSpRawStartDma(1, 0x04001000, (void*)tp->t.ucode_boot, tp->t.ucode_boot_size) == -1); } void osSpTaskStartGo(OSTask* tp) { - while (__osSpDeviceBusy()); - - __osSpSetStatus(293); + while (__osSpDeviceBusy()); + + __osSpSetStatus(293); } diff --git a/src/libultra/io/vigetcurrcontext.c b/src/libultra/io/vigetcurrcontext.c index ca60ea825e..f5c7bb8397 100644 --- a/src/libultra/io/vigetcurrcontext.c +++ b/src/libultra/io/vigetcurrcontext.c @@ -3,5 +3,5 @@ #include __OSViContext* __osViGetCurrentContext(void) { - return __osViCurr; + return __osViCurr; } diff --git a/src/libultra/libc/string.c b/src/libultra/libc/string.c index 904c66811e..2e099ac8db 100644 --- a/src/libultra/libc/string.c +++ b/src/libultra/libc/string.c @@ -3,37 +3,37 @@ unsigned char* strchr(const unsigned char* s, int c) { const unsigned char ch = c; - - while ( *s != ch) { - if (*s == '\0') { - return NULL; - } - s++; - } - - return (unsigned char*)s; + + while ( *s != ch) { + if (*s == '\0') { + return NULL; + } + s++; + } + + return (unsigned char*)s; } size_t strlen(const unsigned char* s) { const unsigned char* sc = s; - - while (*sc != '\0') sc++; - - return (size_t)(sc - s); + + while (*sc != '\0') sc++; + + return (size_t)(sc - s); } void* memcpy(void* s1, const void* s2, size_t n) { unsigned char* su1 = (unsigned char*)s1; const unsigned char* su2 = (const unsigned char*)s2; - - while (n > 0) { - *su1 = *su2; - su1++; - su2++; - n--; - } - - return s1; + + while (n > 0) { + *su1 = *su2; + su1++; + su2++; + n--; + } + + return s1; } diff --git a/src/libultra/os/createthread.c b/src/libultra/os/createthread.c index 590e1773f9..9bc2db8640 100644 --- a/src/libultra/os/createthread.c +++ b/src/libultra/os/createthread.c @@ -2,28 +2,28 @@ #include void osCreateThread(OSThread* t, OSId id, void(*entry)(void*), void* arg, void* sp, OSPri p) { - register u32 saveMask; - OSIntMask mask; - - t->id = id; - t->priority = p; - t->next = NULL; - t->queue = NULL; - t->context.pc = (u32)entry; - t->context.a0 = (u64)arg; - t->context.sp = (u64)sp - 16; - t->context.ra = (u64)__osCleanupThread; - - mask = 0x3FFF01; - t->context.sr = 0xFF03; - t->context.rcp = (mask & 0x3F0000) >> 16; + register u32 saveMask; + OSIntMask mask; + + t->id = id; + t->priority = p; + t->next = NULL; + t->queue = NULL; + t->context.pc = (u32)entry; + t->context.a0 = (u64)arg; + t->context.sp = (u64)sp - 16; + t->context.ra = (u64)__osCleanupThread; + + mask = 0x3FFF01; + t->context.sr = 0xFF03; + t->context.rcp = (mask & 0x3F0000) >> 16; t->context.fpcsr = 0x01000800; t->fp = 0; t->state = 1; t->flags = 0; - + saveMask = __osDisableInt(); t->tlnext = __osActiveQueue; __osActiveQueue = t; - __osRestoreInt(saveMask); + __osRestoreInt(saveMask); } diff --git a/src/libultra/os/destroythread.c b/src/libultra/os/destroythread.c index 07e0a6a0d3..f9ab40043a 100644 --- a/src/libultra/os/destroythread.c +++ b/src/libultra/os/destroythread.c @@ -5,32 +5,32 @@ void osDestroyThread(OSThread* t) register u32 saveMask; register OSThread* pred; register OSThread* succ; - - saveMask = __osDisableInt(); - - if (t == NULL) { - t = __osRunningThread; - } else if (t->state != 1) { - __osDequeueThread(t->queue, t); - } - - if (__osActiveQueue == t) { - __osActiveQueue = __osActiveQueue->tlnext; - } else { - pred = __osActiveQueue; - while (pred->priority != -1) { - succ = pred->tlnext; - if (succ == t) { - pred->tlnext = t->tlnext; - break; - } - pred = succ; - } - } - - if (t == __osRunningThread) { - __osDispatchThread(); - } - - __osRestoreInt(saveMask); + + saveMask = __osDisableInt(); + + if (t == NULL) { + t = __osRunningThread; + } else if (t->state != 1) { + __osDequeueThread(t->queue, t); + } + + if (__osActiveQueue == t) { + __osActiveQueue = __osActiveQueue->tlnext; + } else { + pred = __osActiveQueue; + while (pred->priority != -1) { + succ = pred->tlnext; + if (succ == t) { + pred->tlnext = t->tlnext; + break; + } + pred = succ; + } + } + + if (t == __osRunningThread) { + __osDispatchThread(); + } + + __osRestoreInt(saveMask); } diff --git a/src/libultra/os/getcurrfaultthread.c b/src/libultra/os/getcurrfaultthread.c index 675b012586..a1d4583915 100644 --- a/src/libultra/os/getcurrfaultthread.c +++ b/src/libultra/os/getcurrfaultthread.c @@ -1,5 +1,5 @@ #include OSThread* __osGetCurrFaultedThread(void) { - return __osFaultedThread; + return __osFaultedThread; } diff --git a/src/libultra/os/getthreadid.c b/src/libultra/os/getthreadid.c index 6ae7cd6ab6..d1bd60f9e4 100644 --- a/src/libultra/os/getthreadid.c +++ b/src/libultra/os/getthreadid.c @@ -1,8 +1,8 @@ #include OSId osGetThreadId(OSThread* t) { - if (t == NULL) { - t = __osRunningThread; - } - return t->id; + if (t == NULL) { + t = __osRunningThread; + } + return t->id; } diff --git a/src/libultra/os/jammesg.c b/src/libultra/os/jammesg.c index 631f96a520..552b15bdcf 100644 --- a/src/libultra/os/jammesg.c +++ b/src/libultra/os/jammesg.c @@ -1,29 +1,29 @@ #include s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag) { - register u32 saveMask; + register u32 saveMask; - saveMask = __osDisableInt(); + saveMask = __osDisableInt(); - while (mq->validCount >= mq->msgCount) { - if (flag == 1) { - __osRunningThread->state = 8; - __osEnqueueAndYield(&mq->fullqueue); - } else { - __osRestoreInt(saveMask); - return -1; - } - } + while (mq->validCount >= mq->msgCount) { + if (flag == 1) { + __osRunningThread->state = 8; + __osEnqueueAndYield(&mq->fullqueue); + } else { + __osRestoreInt(saveMask); + return -1; + } + } - mq->first = (mq->first + mq->msgCount - 1) % mq->msgCount; + mq->first = (mq->first + mq->msgCount - 1) % mq->msgCount; - mq->msg[mq->first] = msg; - mq->validCount++; + mq->msg[mq->first] = msg; + mq->validCount++; - if (mq->mtqueue->next != NULL) { - osStartThread(__osPopThread(&mq->mtqueue)); - } + if (mq->mtqueue->next != NULL) { + osStartThread(__osPopThread(&mq->mtqueue)); + } - __osRestoreInt(saveMask); - return 0; + __osRestoreInt(saveMask); + return 0; } diff --git a/src/libultra/os/recvmesg.c b/src/libultra/os/recvmesg.c index 40887f6dcd..887ab5cfde 100644 --- a/src/libultra/os/recvmesg.c +++ b/src/libultra/os/recvmesg.c @@ -1,32 +1,32 @@ #include s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flags) { - register u32 saveMask; - - saveMask = __osDisableInt(); + register u32 saveMask; + + saveMask = __osDisableInt(); - while (mq->validCount == 0) - { - if (flags == 0) - { - __osRestoreInt(saveMask); - return -1; - } - __osRunningThread->state = 8; - __osEnqueueAndYield(&mq->mtqueue); - } + while (mq->validCount == 0) + { + if (flags == 0) + { + __osRestoreInt(saveMask); + return -1; + } + __osRunningThread->state = 8; + __osEnqueueAndYield(&mq->mtqueue); + } - if (msg != NULL) { - *msg = mq->msg[mq->first]; - } - - mq->first = (mq->first + 1) % mq->msgCount; - mq->validCount--; - - if (mq->fullqueue->next != NULL) { - osStartThread(__osPopThread(&mq->fullqueue)); - } + if (msg != NULL) { + *msg = mq->msg[mq->first]; + } + + mq->first = (mq->first + 1) % mq->msgCount; + mq->validCount--; + + if (mq->fullqueue->next != NULL) { + osStartThread(__osPopThread(&mq->fullqueue)); + } - __osRestoreInt(saveMask); - return 0; + __osRestoreInt(saveMask); + return 0; } diff --git a/src/libultra/os/sendmesg.c b/src/libultra/os/sendmesg.c index 78b1101d72..09208c422a 100644 --- a/src/libultra/os/sendmesg.c +++ b/src/libultra/os/sendmesg.c @@ -1,30 +1,30 @@ #include s32 osSendMesg(OSMesgQueue* mq, OSMesg msg, s32 flags) { - register u32 saveMask; - register s32 last; - - saveMask = __osDisableInt(); - - while (mq->validCount >= mq->msgCount) { - if (flags == 1) { - __osRunningThread->state = 8; - __osEnqueueAndYield(&mq->fullqueue); - } else { - __osRestoreInt(saveMask); - return -1; - } - } - - last = (mq->first + mq->validCount) % mq->msgCount; - - mq->msg[last] = msg; - mq->validCount++; - - if (mq->mtqueue->next != NULL) { - osStartThread(__osPopThread(&mq->mtqueue)); - } - - __osRestoreInt(saveMask); - return 0; + register u32 saveMask; + register s32 last; + + saveMask = __osDisableInt(); + + while (mq->validCount >= mq->msgCount) { + if (flags == 1) { + __osRunningThread->state = 8; + __osEnqueueAndYield(&mq->fullqueue); + } else { + __osRestoreInt(saveMask); + return -1; + } + } + + last = (mq->first + mq->validCount) % mq->msgCount; + + mq->msg[last] = msg; + mq->validCount++; + + if (mq->mtqueue->next != NULL) { + osStartThread(__osPopThread(&mq->mtqueue)); + } + + __osRestoreInt(saveMask); + return 0; } diff --git a/src/libultra/os/seteventmesg.c b/src/libultra/os/seteventmesg.c index f0c6b07817..26b764f861 100644 --- a/src/libultra/os/seteventmesg.c +++ b/src/libultra/os/seteventmesg.c @@ -1,22 +1,22 @@ #include void osSetEventMesg(OSEvent e, OSMesgQueue* mq, OSMesg m) { - register u32 saveMask; - __OSEventState* es; - - saveMask = __osDisableInt(); - - es = &__osEventStateTab[e]; - - es->messageQueue = mq; - es->message = m; - - if (e == 14) { - if (__osShutdown != 0 && D_80097F10 == 0) { - osSendMesg(mq, m, 0); - } - D_80097F10 = 1; - } - - __osRestoreInt(saveMask); + register u32 saveMask; + __OSEventState* es; + + saveMask = __osDisableInt(); + + es = &__osEventStateTab[e]; + + es->messageQueue = mq; + es->message = m; + + if (e == 14) { + if (__osShutdown != 0 && D_80097F10 == 0) { + osSendMesg(mq, m, 0); + } + D_80097F10 = 1; + } + + __osRestoreInt(saveMask); } diff --git a/src/libultra/os/startthread.c b/src/libultra/os/startthread.c index fa0ef632e5..a4a3eaa203 100644 --- a/src/libultra/os/startthread.c +++ b/src/libultra/os/startthread.c @@ -1,35 +1,35 @@ #include void osStartThread(OSThread* t) { - register u32 saveMask; - - saveMask = __osDisableInt(); - - switch (t->state) { - case 8: - t->state = 2; - __osEnqueueThread(&__osRunQueue, t); - break; - case 1: - if ((t->queue == NULL) || (t->queue == &__osRunQueue)) { - t->state = 2; - __osEnqueueThread(&__osRunQueue, t); - } else { - t->state = 8; - __osEnqueueThread(t->queue, t); - __osEnqueueThread(&__osRunQueue, __osPopThread(t->queue)); - } - break; - } - - if (__osRunningThread == NULL) { - __osDispatchThread(); - } else { - if (__osRunningThread->priority < __osRunQueue->priority) { - __osRunningThread->state = 2; - __osEnqueueAndYield(&__osRunQueue); - } - } - - __osRestoreInt(saveMask); + register u32 saveMask; + + saveMask = __osDisableInt(); + + switch (t->state) { + case 8: + t->state = 2; + __osEnqueueThread(&__osRunQueue, t); + break; + case 1: + if ((t->queue == NULL) || (t->queue == &__osRunQueue)) { + t->state = 2; + __osEnqueueThread(&__osRunQueue, t); + } else { + t->state = 8; + __osEnqueueThread(t->queue, t); + __osEnqueueThread(&__osRunQueue, __osPopThread(t->queue)); + } + break; + } + + if (__osRunningThread == NULL) { + __osDispatchThread(); + } else { + if (__osRunningThread->priority < __osRunQueue->priority) { + __osRunningThread->state = 2; + __osEnqueueAndYield(&__osRunQueue); + } + } + + __osRestoreInt(saveMask); } diff --git a/src/libultra/os/stopthread.c b/src/libultra/os/stopthread.c index 274aa24963..b5be041d26 100644 --- a/src/libultra/os/stopthread.c +++ b/src/libultra/os/stopthread.c @@ -1,29 +1,29 @@ #include void osStopThread(OSThread* t) { - register u32 saveMask; - register u16 state; - - saveMask = __osDisableInt(); + register u32 saveMask; + register u16 state; + + saveMask = __osDisableInt(); - if (t == NULL) { - state = 4; - } else { - state = t->state; - } - - switch (state) - { - case 4: - __osRunningThread->state = 1; - __osEnqueueAndYield(NULL); - break; - case 2: - case 8: - t->state = 1; - __osDequeueThread(t->queue, t); - break; - } + if (t == NULL) { + state = 4; + } else { + state = t->state; + } + + switch (state) + { + case 4: + __osRunningThread->state = 1; + __osEnqueueAndYield(NULL); + break; + case 2: + case 8: + t->state = 1; + __osDequeueThread(t->queue, t); + break; + } - __osRestoreInt(saveMask); + __osRestoreInt(saveMask); } diff --git a/src/libultra/os/stoptimer.c b/src/libultra/os/stoptimer.c index 02d61189a2..da4e526fef 100644 --- a/src/libultra/os/stoptimer.c +++ b/src/libultra/os/stoptimer.c @@ -7,29 +7,29 @@ int osStopTimer(OSTimer* t) { register u32 savedMask; OSTimer* timep; - - if (t->next == NULL) { - return -1; - } - - savedMask = __osDisableInt(); - - timep = t->next; - - if (timep != __osTimerList) { - timep->value += t->value; - } - - t->prev->next = t->next; - t->next->prev = t->prev; - t->next = NULL; - t->prev = NULL; - - if (__osTimerList->next == __osTimerList) { - __osSetCompare(0); - } - - __osRestoreInt(savedMask); - - return 0; + + if (t->next == NULL) { + return -1; + } + + savedMask = __osDisableInt(); + + timep = t->next; + + if (timep != __osTimerList) { + timep->value += t->value; + } + + t->prev->next = t->next; + t->next->prev = t->prev; + t->next = NULL; + t->prev = NULL; + + if (__osTimerList->next == __osTimerList) { + __osSetCompare(0); + } + + __osRestoreInt(savedMask); + + return 0; } diff --git a/src/libultra/os/thread.c b/src/libultra/os/thread.c index 06a67de90f..5cc9f9d3d2 100644 --- a/src/libultra/os/thread.c +++ b/src/libultra/os/thread.c @@ -5,15 +5,15 @@ void __osDequeueThread(OSThread** queue, OSThread* t) { register OSThread* pred; register OSThread* succ; - - pred = (OSThread*)queue; //! This seems questionable, but the function matches... - succ = pred->next; - while (succ != NULL) { - if (succ == t) { - pred->next = t->next; - return; - } - pred = succ; - succ = pred->next; - } + + pred = (OSThread*)queue; //! This seems questionable, but the function matches... + succ = pred->next; + while (succ != NULL) { + if (succ == t) { + pred->next = t->next; + return; + } + pred = succ; + succ = pred->next; + } } diff --git a/src/libultra/os/virtualtophysical.c b/src/libultra/os/virtualtophysical.c index 4b48f79a0e..6879f2e951 100644 --- a/src/libultra/os/virtualtophysical.c +++ b/src/libultra/os/virtualtophysical.c @@ -2,11 +2,11 @@ #include u32 osVirtualToPhysical(void* virtualAddress) { - if (((u32)virtualAddress >= 0x80000000) && ((u32)virtualAddress < 0xA0000000)) { - return (u32)virtualAddress & 0x1FFFFFFF; - } else if (((u32)virtualAddress >= 0xA0000000) && ((u32)virtualAddress < 0xC0000000)) { - return (u32)virtualAddress & 0x1FFFFFFF; - } else { - return __osProbeTLB(virtualAddress); - } + if (((u32)virtualAddress >= 0x80000000) && ((u32)virtualAddress < 0xA0000000)) { + return (u32)virtualAddress & 0x1FFFFFFF; + } else if (((u32)virtualAddress >= 0xA0000000) && ((u32)virtualAddress < 0xC0000000)) { + return (u32)virtualAddress & 0x1FFFFFFF; + } else { + return __osProbeTLB(virtualAddress); + } } diff --git a/src/olv_En_Test.c.ignore b/src/olv_En_Test.c.ignore index 194edcecbf..49795c6ae3 100644 --- a/src/olv_En_Test.c.ignore +++ b/src/olv_En_Test.c.ignore @@ -2,163 +2,163 @@ #include typedef struct s80862B70_s { - /* 0 */ u32 unk0; - /* 4 */ u32 unk4; - /* 8 */ f32 unk8; - /* 12 */ f32 unk12; - /* 16 */ f32 unk16; - /* 20 */ f32 unk20; - /* 24 */ f32 unk24; - /* 28 */ f32 unk28; - /* 32 */ f32 unk32; - /* 36 */ f32 unk36; - /* 40 */ f32 unk40; - /* 44 */ f32 unk44; - /* 48 */ u16 unk48; - /* 50 */ u16 unk50; - /* 52 */ u16 unk52; - /* 54 */ u16 unk54; - /* 56 */ u16 unk56; - /* 58 */ u16 unk58; + /* 0 */ u32 unk0; + /* 4 */ u32 unk4; + /* 8 */ f32 unk8; + /* 12 */ f32 unk12; + /* 16 */ f32 unk16; + /* 20 */ f32 unk20; + /* 24 */ f32 unk24; + /* 28 */ f32 unk28; + /* 32 */ f32 unk32; + /* 36 */ f32 unk36; + /* 40 */ f32 unk40; + /* 44 */ f32 unk44; + /* 48 */ u16 unk48; + /* 50 */ u16 unk50; + /* 52 */ u16 unk52; + /* 54 */ u16 unk54; + /* 56 */ u16 unk56; + /* 58 */ u16 unk58; } s80862B70; static const f32 D_808637D0 = 1.0; void func_80862B70(void* a0) { - u32 i; - s80862B70* s; - f32 f = D_808637D0; - for (i = 0; i < 20; ++i) { - s = &((s80862B70*)a0)[i]; - s->unk0 = 0; - s->unk4 = 0; - s->unk8 = 0.0; - s->unk12 = 0.0; - s->unk16 = 0.0; - s->unk20 = 0.0; - s->unk24 = 0.0; - s->unk28 = 0.0; - s->unk32 = 0.0; - s->unk36 = 0.0; - s->unk40 = 0.0; - s->unk44 = f; - s->unk48 = 0; - s->unk50 = 0; - s->unk52 = 0; - s->unk54 = 0; - s->unk56 = 0; - s->unk58 = 0; - } + u32 i; + s80862B70* s; + f32 f = D_808637D0; + for (i = 0; i < 20; ++i) { + s = &((s80862B70*)a0)[i]; + s->unk0 = 0; + s->unk4 = 0; + s->unk8 = 0.0; + s->unk12 = 0.0; + s->unk16 = 0.0; + s->unk20 = 0.0; + s->unk24 = 0.0; + s->unk28 = 0.0; + s->unk32 = 0.0; + s->unk36 = 0.0; + s->unk40 = 0.0; + s->unk44 = f; + s->unk48 = 0; + s->unk50 = 0; + s->unk52 = 0; + s->unk54 = 0; + s->unk56 = 0; + s->unk58 = 0; + } } UNK_RET func_80862CBC(UNK_ARGS) { - + } UNK_RET func_80862EDC(UNK_ARGS) { - + } UNK_RET func_80863048(UNK_ARGS) { - + } typedef struct s80863188_t { - u8 pad0[28]; - /* 28 */ s16 unk28; - u8 pad1[6]; - /* 36 */ UNK_TYPE unk36; - /* 40 */ f32 unk40; - /* 44 */ UNK_TYPE unk44; - /* 48 */ UNK_TYPE unk48; - /* 52 */ u16 unk52; - u8 pad2[74]; - /* 128 */ UNK_TYPE unk128; - u8 pad3[4]; - /* 136 */ f32 unk136; - u8 pad8[48]; - /* 188 */ UNK_TYPE unk188; - u8 pad9[132]; - /* 324 */ UNK_TYPE unk324; - u8 pad4[12]; - /* 340 */ f32 unk340; - u8 pad5[28]; - /* 372 */ UNK_TYPE unk372; - /* 376 */ UNK_TYPE unk376; - u8 pad6[68]; - /* 448 */ UNK_TYPE unk448; - u8 pad10[69]; - /* 521 */ u8 unk521; - /* 522 */ u8 unk522; - u8 pad7[1]; - /* 524 */ UNK_TYPE unk524; + u8 pad0[28]; + /* 28 */ s16 unk28; + u8 pad1[6]; + /* 36 */ UNK_TYPE unk36; + /* 40 */ f32 unk40; + /* 44 */ UNK_TYPE unk44; + /* 48 */ UNK_TYPE unk48; + /* 52 */ u16 unk52; + u8 pad2[74]; + /* 128 */ UNK_TYPE unk128; + u8 pad3[4]; + /* 136 */ f32 unk136; + u8 pad8[48]; + /* 188 */ UNK_TYPE unk188; + u8 pad9[132]; + /* 324 */ UNK_TYPE unk324; + u8 pad4[12]; + /* 340 */ f32 unk340; + u8 pad5[28]; + /* 372 */ UNK_TYPE unk372; + /* 376 */ UNK_TYPE unk376; + u8 pad6[68]; + /* 448 */ UNK_TYPE unk448; + u8 pad10[69]; + /* 521 */ u8 unk521; + /* 522 */ u8 unk522; + u8 pad7[1]; + /* 524 */ UNK_TYPE unk524; } s80863188; // En_Test Init UNK_RET func_80863188(UNK_TYPE a0, UNK_TYPE a1) { - s80863188* actor = (s80863188*)a0; - UNK_TYPE sp56; - UNK_TYPE sp52; - UNK_TYPE* sp48; - UNK_TYPE sp40; - UNK_TYPE sp20; - UNK_TYPE* sp16; - f32 f0; - - actor->unk521 = 0; - actor->unk372 = 0; - if (actor->unk28 > 0) { - func_800B67E0(a0, ((f32)actor->unk28)/D_808637E8); - actor->unk522 = 0; - } else { - actor->unk40 = actor->unk40 + 10.0f; - actor->unk128 = 0; - sp40 = a1 + 2096; - func_800C40B4(sp40, &actor->unk128, &sp52, &actor->unk36); - - f0 = actor->unk136; - if ((actor->unk128 == 0) || (f0 != -32000)) { - func_800B670C(a0); - return; - } - - actor->unk40 = f0; - - sp16 = &sp56; - sp48 = &actor->unk188; - func_800C0094(actor->unk128, actor->unk36, f0, actor->unk44); - func_8018219C(&sp56, sp48, 1, sp48); - - actor->unk52 = sp48[1]; - actor->unk522 = func_800C9BB8(sp40, actor->unk128, sp52, sp48); - } - - sp16 = &actor->unk448; - sp48 = &actor->unk324; - sp20 = 0; - func_80183430(&actor->unk324, D_0406EB70, D_0406BB0C, &actor->unk376); - - func_801834A8(sp48, D_0406BB0C); - - actor->unk340 = 9.0; - func_80862B70((void*)actor->unk524); + s80863188* actor = (s80863188*)a0; + UNK_TYPE sp56; + UNK_TYPE sp52; + UNK_TYPE* sp48; + UNK_TYPE sp40; + UNK_TYPE sp20; + UNK_TYPE* sp16; + f32 f0; + + actor->unk521 = 0; + actor->unk372 = 0; + if (actor->unk28 > 0) { + func_800B67E0(a0, ((f32)actor->unk28)/D_808637E8); + actor->unk522 = 0; + } else { + actor->unk40 = actor->unk40 + 10.0f; + actor->unk128 = 0; + sp40 = a1 + 2096; + func_800C40B4(sp40, &actor->unk128, &sp52, &actor->unk36); + + f0 = actor->unk136; + if ((actor->unk128 == 0) || (f0 != -32000)) { + func_800B670C(a0); + return; + } + + actor->unk40 = f0; + + sp16 = &sp56; + sp48 = &actor->unk188; + func_800C0094(actor->unk128, actor->unk36, f0, actor->unk44); + func_8018219C(&sp56, sp48, 1, sp48); + + actor->unk52 = sp48[1]; + actor->unk522 = func_800C9BB8(sp40, actor->unk128, sp52, sp48); + } + + sp16 = &actor->unk448; + sp48 = &actor->unk324; + sp20 = 0; + func_80183430(&actor->unk324, D_0406EB70, D_0406BB0C, &actor->unk376); + + func_801834A8(sp48, D_0406BB0C); + + actor->unk340 = 9.0; + func_80862B70((void*)actor->unk524); } // En_Test Dest UNK_RET func_80863310(UNK_TYPE a0, UNK_TYPE a1) { - func_8018349C(a0+324, a0); + func_8018349C(a0+324, a0); } // En_Test Main UNK_RET func_8086333C(UNK_ARGS) { - + } UNK_RET func_808634B8(UNK_ARGS) { - + } // En_Test Draw UNK_RET func_808636A8(UNK_ARGS) { - + } diff --git a/src/test.c b/src/test.c index 904c66811e..2e099ac8db 100644 --- a/src/test.c +++ b/src/test.c @@ -3,37 +3,37 @@ unsigned char* strchr(const unsigned char* s, int c) { const unsigned char ch = c; - - while ( *s != ch) { - if (*s == '\0') { - return NULL; - } - s++; - } - - return (unsigned char*)s; + + while ( *s != ch) { + if (*s == '\0') { + return NULL; + } + s++; + } + + return (unsigned char*)s; } size_t strlen(const unsigned char* s) { const unsigned char* sc = s; - - while (*sc != '\0') sc++; - - return (size_t)(sc - s); + + while (*sc != '\0') sc++; + + return (size_t)(sc - s); } void* memcpy(void* s1, const void* s2, size_t n) { unsigned char* su1 = (unsigned char*)s1; const unsigned char* su2 = (const unsigned char*)s2; - - while (n > 0) { - *su1 = *su2; - su1++; - su2++; - n--; - } - - return s1; + + while (n > 0) { + *su1 = *su2; + su1++; + su2++; + n--; + } + + return s1; }