diff --git a/Makefile b/Makefile index 77262439a4..a7d0e25885 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ build/src/libultra/os/%: OPTIMIZATION := -O1 build/src/libultra/io/%: OPTIMIZATION := -O2 build/src/libultra/libc/%: OPTIMIZATION := -O2 build/src/boot_O2_g3/%: OPTIMIZATION := -O2 -g3 -test.txt: OPTIMIZATION := -O2 -g3 +test.txt: OPTIMIZATION := -O1 -g3 test.txt: MIPS_VERSION := -mips2 BASEROM_FILES := $(wildcard baserom/*) @@ -69,7 +69,7 @@ code.elf: $(S_O_FILES) $(C_O_FILES) codescript.txt undef.txt $(LD) -T codescript.txt -T undef.txt --no-check-sections --accept-unknown-input-arch -o $@ test.txt: build/src/test.o - $(MIPS_BINUTILS)objdump -d -z --adjust-vma=0x800BF9A0 $< > test.txt + $(MIPS_BINUTILS)objdump -d -z --adjust-vma=0x80080180 $< > test.txt clean: rm $(ROM) $(ELF) code.elf code.bin boot.bin -r build diff --git a/include/variables.h b/include/variables.h index 5540fe8c8b..1cc284f3ea 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1874,7 +1874,7 @@ extern u32 D_80096B2C; // D_80096B2C extern f32 D_80096B30; // D_80096B30 extern f32 D_80096B34; // D_80096B34 extern struct s80092920* D_80096B40; // D_80096B40 -extern UNK_PTR D_80096B50; // D_80096B50 +extern UNK_TYPE D_80096B50; // D_80096B50 //extern UNK_TYPE D_80096B60; //extern UNK_TYPE D_80096B68; //extern UNK_TYPE D_80096B70; diff --git a/src/boot/boot_0x80080060.c b/src/boot/boot_0x80080180.c similarity index 60% rename from src/boot/boot_0x80080060.c rename to src/boot/boot_0x80080180.c index 1601b48666..b889b27c4b 100644 --- a/src/boot/boot_0x80080060.c +++ b/src/boot/boot_0x80080180.c @@ -1,26 +1,8 @@ #include #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); -} - -void func_80080150(UNK_PTR a0, UNK_PTR a1) { - 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) { + while (a1 -= sizeof(u32)) { *a0++ = a2; } } @@ -33,13 +15,15 @@ UNK_RET func_8008019C(void) { } UNK_RET func_800801EC(void) { + UNK_TYPE sp28; + UNK_PTR sp24 = (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)); + func_80080150(&D_80208EA0, sp24); } UNK_RET func_80080250(void) { - UNK_PTR v0; + UNK_TYPE* v0; UNK_PTR v1; UNK_PTR t7; UNK_TYPE sp88; @@ -47,29 +31,25 @@ UNK_RET func_80080250(void) { 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); - + OSMesgQueue sp48; + OSMesg sp44; + UNK_TYPE sp40; + + osCreateMesgQueue(&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); + v0 = &D_80096B50; + sp40 = *v0; + *v0 = 0; + + func_80080C04(&sp72, (UNK_FUN_ARG)func_800A5AC0, v1, (u32)t7 - (u32)v1, 0, (UNK_TYPE*)&sp48, 0); func_8008019C(); func_800801EC(); - func_80087ED0(&sp48, 0, 1); - + osRecvMesg(&sp48, 0, 1); + D_80096B50 = sp40; - + func_80080150(&D_801E3FA0, &D_80208EA0); } @@ -84,12 +64,12 @@ UNK_RET func_80080300(UNK_TYPE a0) { void func_8008038C(void) { u32 i; - func_800952A0(254); - + osCreateViManager(254); + D_80096B2C = 66; D_80096B30 = 1.0; D_80096B34 = 1.0; - + switch (osTvType) { case 1: D_8009B290 = 2; @@ -112,17 +92,17 @@ void func_8008038C(void) { } break; } - + D_80096B20 = 1; } void func_80080514(UNK_TYPE a0) { func_8008038C(); - func_8008C020(150, &D_8009B228, &D_8009B160, 50); + osCreatePiManager(150, (OSMesgQueue*)&D_8009B228, (OSMesg*)&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); - + osCreateThread((OSThread*)&D_8009A690, 3, (void (*)(void*))func_80080300, (void*)a0, (void*)&D_8009B140, 12); + osStartThread((OSThread*)&D_8009A690); + osSetThreadPri(NULL, 0); + while(1); } diff --git a/variables.py b/variables.py index 23b2cc83a1..5dadc2b2f2 100644 --- a/variables.py +++ b/variables.py @@ -16,7 +16,7 @@ known_vars = { 0x80096B30:("","f32",False), 0x80096B34:("","f32",False), 0x80096B40:("","struct s80092920*",False), - 0x80096B50:("","UNK_PTR",False), + 0x80096B50:("","UNK_TYPE",False), 0x80096C40:("g_s80085320_ListHead","struct s80085320*",False), # TODO rename? 0x80096C44:("g_s80085320_ListTail","struct s80085320*",False), # TODO rename? 0x80097590:("","UNK_TYPE",False),