diff --git a/Makefile b/Makefile index 6cf2218531..85f04f323c 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ SHELL=/bin/bash -o pipefail # BUILD_DIR is location where all build artifacts are placed BUILD_DIR = build -SRC_DIRS := src src/os +SRC_DIRS := src src/os src/os/nusys ASM_DIRS := asm asm/os INCLUDE_DIRS := include include/PR DATA_DIRS := bin diff --git a/asm/nonmatchings/os/code_39db0_len_8a0/nuScAddClient.s b/asm/nonmatchings/os/code_39db0_len_8a0/nuScAddClient.s deleted file mode 100644 index e0c6e67985..0000000000 --- a/asm/nonmatchings/os/code_39db0_len_8a0/nuScAddClient.s +++ /dev/null @@ -1,40 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel nuScAddClient -/* 3A230 8005EE30 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 3A234 8005EE34 AFB00010 */ sw $s0, 0x10($sp) -/* 3A238 8005EE38 0080802D */ daddu $s0, $a0, $zero -/* 3A23C 8005EE3C AFB20018 */ sw $s2, 0x18($sp) -/* 3A240 8005EE40 00A0902D */ daddu $s2, $a1, $zero -/* 3A244 8005EE44 AFB10014 */ sw $s1, 0x14($sp) -/* 3A248 8005EE48 00C0882D */ daddu $s1, $a2, $zero -/* 3A24C 8005EE4C AFBF001C */ sw $ra, 0x1c($sp) -/* 3A250 8005EE50 0C018250 */ jal osSetIntMask -/* 3A254 8005EE54 24040001 */ addiu $a0, $zero, 1 -/* 3A258 8005EE58 3C05800E */ lui $a1, 0x800e -/* 3A25C 8005EE5C 24A5AAA8 */ addiu $a1, $a1, -0x5558 -/* 3A260 8005EE60 AE120004 */ sw $s2, 4($s0) -/* 3A264 8005EE64 8CA30000 */ lw $v1, ($a1) -/* 3A268 8005EE68 A6110008 */ sh $s1, 8($s0) -/* 3A26C 8005EE6C 32310002 */ andi $s1, $s1, 2 -/* 3A270 8005EE70 AE030000 */ sw $v1, ($s0) -/* 3A274 8005EE74 ACB00000 */ sw $s0, ($a1) -/* 3A278 8005EE78 12200008 */ beqz $s1, .L8005EE9C -/* 3A27C 8005EE7C 0040802D */ daddu $s0, $v0, $zero -/* 3A280 8005EE80 3C02800A */ lui $v0, 0x800a -/* 3A284 8005EE84 9042A5B0 */ lbu $v0, -0x5a50($v0) -/* 3A288 8005EE88 10400004 */ beqz $v0, .L8005EE9C -/* 3A28C 8005EE8C 0240202D */ daddu $a0, $s2, $zero -/* 3A290 8005EE90 24A5F99A */ addiu $a1, $a1, -0x666 -/* 3A294 8005EE94 0C019608 */ jal osSendMesg -/* 3A298 8005EE98 0000302D */ daddu $a2, $zero, $zero -.L8005EE9C: -/* 3A29C 8005EE9C 0C018250 */ jal osSetIntMask -/* 3A2A0 8005EEA0 0200202D */ daddu $a0, $s0, $zero -/* 3A2A4 8005EEA4 8FBF001C */ lw $ra, 0x1c($sp) -/* 3A2A8 8005EEA8 8FB20018 */ lw $s2, 0x18($sp) -/* 3A2AC 8005EEAC 8FB10014 */ lw $s1, 0x14($sp) -/* 3A2B0 8005EEB0 8FB00010 */ lw $s0, 0x10($sp) -/* 3A2B4 8005EEB4 03E00008 */ jr $ra -/* 3A2B8 8005EEB8 27BD0020 */ addiu $sp, $sp, 0x20 diff --git a/asm/nonmatchings/os/code_39db0_len_8a0/nuScCreateScheduler.s b/asm/nonmatchings/os/code_39db0_len_8a0/nuScCreateScheduler.s deleted file mode 100644 index 2ef55cbe20..0000000000 --- a/asm/nonmatchings/os/code_39db0_len_8a0/nuScCreateScheduler.s +++ /dev/null @@ -1,146 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel nuScCreateScheduler -/* 39DB0 8005E9B0 27BDFFD0 */ addiu $sp, $sp, -0x30 -/* 39DB4 8005E9B4 AFB40028 */ sw $s4, 0x28($sp) -/* 39DB8 8005E9B8 0080A02D */ daddu $s4, $a0, $zero -/* 39DBC 8005E9BC AFB30024 */ sw $s3, 0x24($sp) -/* 39DC0 8005E9C0 00A0982D */ daddu $s3, $a1, $zero -/* 39DC4 8005E9C4 3C04800E */ lui $a0, 0x800e -/* 39DC8 8005E9C8 2484AAAC */ addiu $a0, $a0, -0x5554 -/* 39DCC 8005E9CC 24020001 */ addiu $v0, $zero, 1 -/* 39DD0 8005E9D0 24030002 */ addiu $v1, $zero, 2 -/* 39DD4 8005E9D4 AFBF002C */ sw $ra, 0x2c($sp) -/* 39DD8 8005E9D8 AFB20020 */ sw $s2, 0x20($sp) -/* 39DDC 8005E9DC AFB1001C */ sw $s1, 0x1c($sp) -/* 39DE0 8005E9E0 AFB00018 */ sw $s0, 0x18($sp) -/* 39DE4 8005E9E4 A482F994 */ sh $v0, -0x66c($a0) -/* 39DE8 8005E9E8 326200FF */ andi $v0, $s3, 0xff -/* 39DEC 8005E9EC AC82000C */ sw $v0, 0xc($a0) -/* 39DF0 8005E9F0 A0830011 */ sb $v1, 0x11($a0) -/* 39DF4 8005E9F4 3C028000 */ lui $v0, 0x8000 -/* 39DF8 8005E9F8 8C420300 */ lw $v0, 0x300($v0) -/* 39DFC 8005E9FC A483F996 */ sh $v1, -0x66a($a0) -/* 39E00 8005EA00 2483F994 */ addiu $v1, $a0, -0x66c -/* 39E04 8005EA04 AC800000 */ sw $zero, ($a0) -/* 39E08 8005EA08 AC800004 */ sw $zero, 4($a0) -/* 39E0C 8005EA0C AC800008 */ sw $zero, 8($a0) -/* 39E10 8005EA10 14400004 */ bnez $v0, .L8005EA24 -/* 39E14 8005EA14 AC80FFFC */ sw $zero, -4($a0) -/* 39E18 8005EA18 24020032 */ addiu $v0, $zero, 0x32 -/* 39E1C 8005EA1C 08017A8B */ j .L8005EA2C -/* 39E20 8005EA20 A062067C */ sb $v0, 0x67c($v1) -.L8005EA24: -/* 39E24 8005EA24 2402003C */ addiu $v0, $zero, 0x3c -/* 39E28 8005EA28 A0820010 */ sb $v0, 0x10($a0) -.L8005EA2C: -/* 39E2C 8005EA2C 3C10800E */ lui $s0, 0x800e -/* 39E30 8005EA30 2610A4B4 */ addiu $s0, $s0, -0x5b4c -/* 39E34 8005EA34 0200202D */ daddu $a0, $s0, $zero -/* 39E38 8005EA38 26050018 */ addiu $a1, $s0, 0x18 -/* 39E3C 8005EA3C 3C01800A */ lui $at, 0x800a -/* 39E40 8005EA40 A020A5B0 */ sb $zero, -0x5a50($at) -/* 39E44 8005EA44 0C019560 */ jal osCreateMesgQueue -/* 39E48 8005EA48 24060008 */ addiu $a2, $zero, 8 -/* 39E4C 8005EA4C 26120038 */ addiu $s2, $s0, 0x38 -/* 39E50 8005EA50 0240202D */ daddu $a0, $s2, $zero -/* 39E54 8005EA54 26050050 */ addiu $a1, $s0, 0x50 -/* 39E58 8005EA58 0C019560 */ jal osCreateMesgQueue -/* 39E5C 8005EA5C 24060008 */ addiu $a2, $zero, 8 -/* 39E60 8005EA60 26110070 */ addiu $s1, $s0, 0x70 -/* 39E64 8005EA64 0220202D */ daddu $a0, $s1, $zero -/* 39E68 8005EA68 26050088 */ addiu $a1, $s0, 0x88 -/* 39E6C 8005EA6C 0C019560 */ jal osCreateMesgQueue -/* 39E70 8005EA70 24060008 */ addiu $a2, $zero, 8 -/* 39E74 8005EA74 2604FFC8 */ addiu $a0, $s0, -0x38 -/* 39E78 8005EA78 2605FFE0 */ addiu $a1, $s0, -0x20 -/* 39E7C 8005EA7C 0C019560 */ jal osCreateMesgQueue -/* 39E80 8005EA80 24060008 */ addiu $a2, $zero, 8 -/* 39E84 8005EA84 2604FF90 */ addiu $a0, $s0, -0x70 -/* 39E88 8005EA88 2605FFA8 */ addiu $a1, $s0, -0x58 -/* 39E8C 8005EA8C 0C019560 */ jal osCreateMesgQueue -/* 39E90 8005EA90 24060008 */ addiu $a2, $zero, 8 -/* 39E94 8005EA94 260400A8 */ addiu $a0, $s0, 0xa8 -/* 39E98 8005EA98 260500C0 */ addiu $a1, $s0, 0xc0 -/* 39E9C 8005EA9C 0C019560 */ jal osCreateMesgQueue -/* 39EA0 8005EAA0 24060008 */ addiu $a2, $zero, 8 -/* 39EA4 8005EAA4 0C019A9C */ jal osCreateViManager -/* 39EA8 8005EAA8 240400FE */ addiu $a0, $zero, 0xfe -/* 39EAC 8005EAAC 328200FF */ andi $v0, $s4, 0xff -/* 39EB0 8005EAB0 00022080 */ sll $a0, $v0, 2 -/* 39EB4 8005EAB4 00822021 */ addu $a0, $a0, $v0 -/* 39EB8 8005EAB8 00042100 */ sll $a0, $a0, 4 -/* 39EBC 8005EABC 3C028009 */ lui $v0, 0x8009 -/* 39EC0 8005EAC0 244246A0 */ addiu $v0, $v0, 0x46a0 -/* 39EC4 8005EAC4 0C019B84 */ jal osViSetMode -/* 39EC8 8005EAC8 00822021 */ addu $a0, $a0, $v0 -/* 39ECC 8005EACC 0C019CE0 */ jal osViBlack -/* 39ED0 8005EAD0 24040001 */ addiu $a0, $zero, 1 -/* 39ED4 8005EAD4 0200202D */ daddu $a0, $s0, $zero -/* 39ED8 8005EAD8 2405029A */ addiu $a1, $zero, 0x29a -/* 39EDC 8005EADC 0C019B6C */ jal osViSetEvent -/* 39EE0 8005EAE0 326600FF */ andi $a2, $s3, 0xff -/* 39EE4 8005EAE4 24040004 */ addiu $a0, $zero, 4 -/* 39EE8 8005EAE8 0240282D */ daddu $a1, $s2, $zero -/* 39EEC 8005EAEC 0C019654 */ jal osSetEventMesg -/* 39EF0 8005EAF0 2406029B */ addiu $a2, $zero, 0x29b -/* 39EF4 8005EAF4 24040009 */ addiu $a0, $zero, 9 -/* 39EF8 8005EAF8 0220282D */ daddu $a1, $s1, $zero -/* 39EFC 8005EAFC 0C019654 */ jal osSetEventMesg -/* 39F00 8005EB00 2406029C */ addiu $a2, $zero, 0x29c -/* 39F04 8005EB04 2404000E */ addiu $a0, $zero, 0xe -/* 39F08 8005EB08 0200282D */ daddu $a1, $s0, $zero -/* 39F0C 8005EB0C 0C019654 */ jal osSetEventMesg -/* 39F10 8005EB10 2406029D */ addiu $a2, $zero, 0x29d -/* 39F14 8005EB14 261200E4 */ addiu $s2, $s0, 0xe4 -/* 39F18 8005EB18 0240202D */ daddu $a0, $s2, $zero -/* 39F1C 8005EB1C 24050013 */ addiu $a1, $zero, 0x13 -/* 39F20 8005EB20 3C068006 */ lui $a2, 0x8006 -/* 39F24 8005EB24 24C6EFA8 */ addiu $a2, $a2, -0x1058 -/* 39F28 8005EB28 2611FF8C */ addiu $s1, $s0, -0x74 -/* 39F2C 8005EB2C 0220382D */ daddu $a3, $s1, $zero -/* 39F30 8005EB30 3C02800B */ lui $v0, 0x800b -/* 39F34 8005EB34 244285D0 */ addiu $v0, $v0, -0x7a30 -/* 39F38 8005EB38 AFA20010 */ sw $v0, 0x10($sp) -/* 39F3C 8005EB3C 24020078 */ addiu $v0, $zero, 0x78 -/* 39F40 8005EB40 0C019798 */ jal osCreateThread -/* 39F44 8005EB44 AFA20014 */ sw $v0, 0x14($sp) -/* 39F48 8005EB48 0C019808 */ jal osStartThread -/* 39F4C 8005EB4C 0240202D */ daddu $a0, $s2, $zero -/* 39F50 8005EB50 26120294 */ addiu $s2, $s0, 0x294 -/* 39F54 8005EB54 0240202D */ daddu $a0, $s2, $zero -/* 39F58 8005EB58 24050012 */ addiu $a1, $zero, 0x12 -/* 39F5C 8005EB5C 3C068006 */ lui $a2, 0x8006 -/* 39F60 8005EB60 24C6EBE0 */ addiu $a2, $a2, -0x1420 -/* 39F64 8005EB64 0220382D */ daddu $a3, $s1, $zero -/* 39F68 8005EB68 3C02800B */ lui $v0, 0x800b -/* 39F6C 8005EB6C 2442A5D0 */ addiu $v0, $v0, -0x5a30 -/* 39F70 8005EB70 AFA20010 */ sw $v0, 0x10($sp) -/* 39F74 8005EB74 2402006E */ addiu $v0, $zero, 0x6e -/* 39F78 8005EB78 0C019798 */ jal osCreateThread -/* 39F7C 8005EB7C AFA20014 */ sw $v0, 0x14($sp) -/* 39F80 8005EB80 0C019808 */ jal osStartThread -/* 39F84 8005EB84 0240202D */ daddu $a0, $s2, $zero -/* 39F88 8005EB88 26100444 */ addiu $s0, $s0, 0x444 -/* 39F8C 8005EB8C 0200202D */ daddu $a0, $s0, $zero -/* 39F90 8005EB90 24050011 */ addiu $a1, $zero, 0x11 -/* 39F94 8005EB94 3C068006 */ lui $a2, 0x8006 -/* 39F98 8005EB98 24C6ED14 */ addiu $a2, $a2, -0x12ec -/* 39F9C 8005EB9C 0220382D */ daddu $a3, $s1, $zero -/* 39FA0 8005EBA0 3C02800B */ lui $v0, 0x800b -/* 39FA4 8005EBA4 2442C5D0 */ addiu $v0, $v0, -0x3a30 -/* 39FA8 8005EBA8 AFA20010 */ sw $v0, 0x10($sp) -/* 39FAC 8005EBAC 24020064 */ addiu $v0, $zero, 0x64 -/* 39FB0 8005EBB0 0C019798 */ jal osCreateThread -/* 39FB4 8005EBB4 AFA20014 */ sw $v0, 0x14($sp) -/* 39FB8 8005EBB8 0C019808 */ jal osStartThread -/* 39FBC 8005EBBC 0200202D */ daddu $a0, $s0, $zero -/* 39FC0 8005EBC0 8FBF002C */ lw $ra, 0x2c($sp) -/* 39FC4 8005EBC4 8FB40028 */ lw $s4, 0x28($sp) -/* 39FC8 8005EBC8 8FB30024 */ lw $s3, 0x24($sp) -/* 39FCC 8005EBCC 8FB20020 */ lw $s2, 0x20($sp) -/* 39FD0 8005EBD0 8FB1001C */ lw $s1, 0x1c($sp) -/* 39FD4 8005EBD4 8FB00018 */ lw $s0, 0x18($sp) -/* 39FD8 8005EBD8 03E00008 */ jr $ra -/* 39FDC 8005EBDC 27BD0030 */ addiu $sp, $sp, 0x30 diff --git a/asm/nonmatchings/os/code_39db0_len_8a0/nuScExecuteAudio.s b/asm/nonmatchings/os/code_39db0_len_8a0/nuScExecuteAudio.s index b535f0a735..62f7e9fa26 100644 --- a/asm/nonmatchings/os/code_39db0_len_8a0/nuScExecuteAudio.s +++ b/asm/nonmatchings/os/code_39db0_len_8a0/nuScExecuteAudio.s @@ -84,77 +84,3 @@ glabel nuScExecuteAudio /* 3A108 8005ED08 24060001 */ addiu $a2, $zero, 1 /* 3A10C 8005ED0C 08017B06 */ j .L8005EC18 /* 3A110 8005ED10 0280202D */ daddu $a0, $s4, $zero -/* 3A114 8005ED14 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 3A118 8005ED18 AFB00018 */ sw $s0, 0x18($sp) -/* 3A11C 8005ED1C 3C10800E */ lui $s0, 0x800e -/* 3A120 8005ED20 2610A47C */ addiu $s0, $s0, -0x5b84 -/* 3A124 8005ED24 AFB1001C */ sw $s1, 0x1c($sp) -/* 3A128 8005ED28 27B10014 */ addiu $s1, $sp, 0x14 -/* 3A12C 8005ED2C AFBF0020 */ sw $ra, 0x20($sp) -/* 3A130 8005ED30 0200202D */ daddu $a0, $s0, $zero -.L8005ED34: -/* 3A134 8005ED34 27A50010 */ addiu $a1, $sp, 0x10 -/* 3A138 8005ED38 0C0195BC */ jal osRecvMesg -/* 3A13C 8005ED3C 24060001 */ addiu $a2, $zero, 1 -/* 3A140 8005ED40 3C02800A */ lui $v0, 0x800a -/* 3A144 8005ED44 9042A5B0 */ lbu $v0, -0x5a50($v0) -/* 3A148 8005ED48 30420002 */ andi $v0, $v0, 2 -/* 3A14C 8005ED4C 14400032 */ bnez $v0, .L8005EE18 -/* 3A150 8005ED50 00000000 */ nop -/* 3A154 8005ED54 0C017C48 */ jal nuScWaitTaskReady -/* 3A158 8005ED58 8FA40010 */ lw $a0, 0x10($sp) -/* 3A15C 8005ED5C 0C018250 */ jal osSetIntMask -/* 3A160 8005ED60 24040001 */ addiu $a0, $zero, 1 -/* 3A164 8005ED64 8E030634 */ lw $v1, 0x634($s0) -/* 3A168 8005ED68 1060000C */ beqz $v1, .L8005ED9C -/* 3A16C 8005ED6C 0040202D */ daddu $a0, $v0, $zero -/* 3A170 8005ED70 8FA20010 */ lw $v0, 0x10($sp) -/* 3A174 8005ED74 0C018250 */ jal osSetIntMask -/* 3A178 8005ED78 AE020638 */ sw $v0, 0x638($s0) -/* 3A17C 8005ED7C 260400E0 */ addiu $a0, $s0, 0xe0 -/* 3A180 8005ED80 27A50014 */ addiu $a1, $sp, 0x14 -/* 3A184 8005ED84 0C0195BC */ jal osRecvMesg -/* 3A188 8005ED88 24060001 */ addiu $a2, $zero, 1 -/* 3A18C 8005ED8C 0C018250 */ jal osSetIntMask -/* 3A190 8005ED90 24040001 */ addiu $a0, $zero, 1 -/* 3A194 8005ED94 0040202D */ daddu $a0, $v0, $zero -/* 3A198 8005ED98 AE000638 */ sw $zero, 0x638($s0) -.L8005ED9C: -/* 3A19C 8005ED9C 0C018250 */ jal osSetIntMask -/* 3A1A0 8005EDA0 00000000 */ nop -/* 3A1A4 8005EDA4 0C018250 */ jal osSetIntMask -/* 3A1A8 8005EDA8 24040001 */ addiu $a0, $zero, 1 -/* 3A1AC 8005EDAC 8FA30010 */ lw $v1, 0x10($sp) -/* 3A1B0 8005EDB0 0040202D */ daddu $a0, $v0, $zero -/* 3A1B4 8005EDB4 0C018250 */ jal osSetIntMask -/* 3A1B8 8005EDB8 AE030630 */ sw $v1, 0x630($s0) -/* 3A1BC 8005EDBC 8FA40010 */ lw $a0, 0x10($sp) -/* 3A1C0 8005EDC0 0C019684 */ jal osSpTaskLoad -/* 3A1C4 8005EDC4 24840010 */ addiu $a0, $a0, 0x10 -/* 3A1C8 8005EDC8 8FA40010 */ lw $a0, 0x10($sp) -/* 3A1CC 8005EDCC 0C019707 */ jal osSpTaskStartGo -/* 3A1D0 8005EDD0 24840010 */ addiu $a0, $a0, 0x10 -/* 3A1D4 8005EDD4 26040070 */ addiu $a0, $s0, 0x70 -/* 3A1D8 8005EDD8 0220282D */ daddu $a1, $s1, $zero -/* 3A1DC 8005EDDC 0C0195BC */ jal osRecvMesg -/* 3A1E0 8005EDE0 24060001 */ addiu $a2, $zero, 1 -/* 3A1E4 8005EDE4 0C018250 */ jal osSetIntMask -/* 3A1E8 8005EDE8 24040001 */ addiu $a0, $zero, 1 -/* 3A1EC 8005EDEC 0040202D */ daddu $a0, $v0, $zero -/* 3A1F0 8005EDF0 0C018250 */ jal osSetIntMask -/* 3A1F4 8005EDF4 AE000630 */ sw $zero, 0x630($s0) -/* 3A1F8 8005EDF8 8FA20010 */ lw $v0, 0x10($sp) -/* 3A1FC 8005EDFC 8C420008 */ lw $v0, 8($v0) -/* 3A200 8005EE00 30420002 */ andi $v0, $v0, 2 -/* 3A204 8005EE04 14400004 */ bnez $v0, .L8005EE18 -/* 3A208 8005EE08 260400A8 */ addiu $a0, $s0, 0xa8 -/* 3A20C 8005EE0C 0220282D */ daddu $a1, $s1, $zero -/* 3A210 8005EE10 0C0195BC */ jal osRecvMesg -/* 3A214 8005EE14 24060001 */ addiu $a2, $zero, 1 -.L8005EE18: -/* 3A218 8005EE18 8FA50010 */ lw $a1, 0x10($sp) -/* 3A21C 8005EE1C 8CA40050 */ lw $a0, 0x50($a1) -/* 3A220 8005EE20 0C019608 */ jal osSendMesg -/* 3A224 8005EE24 24060001 */ addiu $a2, $zero, 1 -/* 3A228 8005EE28 08017B4D */ j .L8005ED34 -/* 3A22C 8005EE2C 0200202D */ daddu $a0, $s0, $zero diff --git a/asm/nonmatchings/os/code_39db0_len_8a0/nuScExecuteGraphics.s b/asm/nonmatchings/os/code_39db0_len_8a0/nuScExecuteGraphics.s new file mode 100644 index 0000000000..0858f9d641 --- /dev/null +++ b/asm/nonmatchings/os/code_39db0_len_8a0/nuScExecuteGraphics.s @@ -0,0 +1,79 @@ +.set noat # allow manual use of $at +.set noreorder # don't insert nops after branches + +glabel nuScExecuteGraphics + +/* 3A114 8005ED14 27BDFFD8 */ addiu $sp, $sp, -0x28 +/* 3A118 8005ED18 AFB00018 */ sw $s0, 0x18($sp) +/* 3A11C 8005ED1C 3C10800E */ lui $s0, 0x800e +/* 3A120 8005ED20 2610A47C */ addiu $s0, $s0, -0x5b84 +/* 3A124 8005ED24 AFB1001C */ sw $s1, 0x1c($sp) +/* 3A128 8005ED28 27B10014 */ addiu $s1, $sp, 0x14 +/* 3A12C 8005ED2C AFBF0020 */ sw $ra, 0x20($sp) +/* 3A130 8005ED30 0200202D */ daddu $a0, $s0, $zero +.L8005ED34: +/* 3A134 8005ED34 27A50010 */ addiu $a1, $sp, 0x10 +/* 3A138 8005ED38 0C0195BC */ jal osRecvMesg +/* 3A13C 8005ED3C 24060001 */ addiu $a2, $zero, 1 +/* 3A140 8005ED40 3C02800A */ lui $v0, 0x800a +/* 3A144 8005ED44 9042A5B0 */ lbu $v0, -0x5a50($v0) +/* 3A148 8005ED48 30420002 */ andi $v0, $v0, 2 +/* 3A14C 8005ED4C 14400032 */ bnez $v0, .L8005EE18 +/* 3A150 8005ED50 00000000 */ nop +/* 3A154 8005ED54 0C017C48 */ jal nuScWaitTaskReady +/* 3A158 8005ED58 8FA40010 */ lw $a0, 0x10($sp) +/* 3A15C 8005ED5C 0C018250 */ jal osSetIntMask +/* 3A160 8005ED60 24040001 */ addiu $a0, $zero, 1 +/* 3A164 8005ED64 8E030634 */ lw $v1, 0x634($s0) +/* 3A168 8005ED68 1060000C */ beqz $v1, .L8005ED9C +/* 3A16C 8005ED6C 0040202D */ daddu $a0, $v0, $zero +/* 3A170 8005ED70 8FA20010 */ lw $v0, 0x10($sp) +/* 3A174 8005ED74 0C018250 */ jal osSetIntMask +/* 3A178 8005ED78 AE020638 */ sw $v0, 0x638($s0) +/* 3A17C 8005ED7C 260400E0 */ addiu $a0, $s0, 0xe0 +/* 3A180 8005ED80 27A50014 */ addiu $a1, $sp, 0x14 +/* 3A184 8005ED84 0C0195BC */ jal osRecvMesg +/* 3A188 8005ED88 24060001 */ addiu $a2, $zero, 1 +/* 3A18C 8005ED8C 0C018250 */ jal osSetIntMask +/* 3A190 8005ED90 24040001 */ addiu $a0, $zero, 1 +/* 3A194 8005ED94 0040202D */ daddu $a0, $v0, $zero +/* 3A198 8005ED98 AE000638 */ sw $zero, 0x638($s0) +.L8005ED9C: +/* 3A19C 8005ED9C 0C018250 */ jal osSetIntMask +/* 3A1A0 8005EDA0 00000000 */ nop +/* 3A1A4 8005EDA4 0C018250 */ jal osSetIntMask +/* 3A1A8 8005EDA8 24040001 */ addiu $a0, $zero, 1 +/* 3A1AC 8005EDAC 8FA30010 */ lw $v1, 0x10($sp) +/* 3A1B0 8005EDB0 0040202D */ daddu $a0, $v0, $zero +/* 3A1B4 8005EDB4 0C018250 */ jal osSetIntMask +/* 3A1B8 8005EDB8 AE030630 */ sw $v1, 0x630($s0) +/* 3A1BC 8005EDBC 8FA40010 */ lw $a0, 0x10($sp) +/* 3A1C0 8005EDC0 0C019684 */ jal osSpTaskLoad +/* 3A1C4 8005EDC4 24840010 */ addiu $a0, $a0, 0x10 +/* 3A1C8 8005EDC8 8FA40010 */ lw $a0, 0x10($sp) +/* 3A1CC 8005EDCC 0C019707 */ jal osSpTaskStartGo +/* 3A1D0 8005EDD0 24840010 */ addiu $a0, $a0, 0x10 +/* 3A1D4 8005EDD4 26040070 */ addiu $a0, $s0, 0x70 +/* 3A1D8 8005EDD8 0220282D */ daddu $a1, $s1, $zero +/* 3A1DC 8005EDDC 0C0195BC */ jal osRecvMesg +/* 3A1E0 8005EDE0 24060001 */ addiu $a2, $zero, 1 +/* 3A1E4 8005EDE4 0C018250 */ jal osSetIntMask +/* 3A1E8 8005EDE8 24040001 */ addiu $a0, $zero, 1 +/* 3A1EC 8005EDEC 0040202D */ daddu $a0, $v0, $zero +/* 3A1F0 8005EDF0 0C018250 */ jal osSetIntMask +/* 3A1F4 8005EDF4 AE000630 */ sw $zero, 0x630($s0) +/* 3A1F8 8005EDF8 8FA20010 */ lw $v0, 0x10($sp) +/* 3A1FC 8005EDFC 8C420008 */ lw $v0, 8($v0) +/* 3A200 8005EE00 30420002 */ andi $v0, $v0, 2 +/* 3A204 8005EE04 14400004 */ bnez $v0, .L8005EE18 +/* 3A208 8005EE08 260400A8 */ addiu $a0, $s0, 0xa8 +/* 3A20C 8005EE0C 0220282D */ daddu $a1, $s1, $zero +/* 3A210 8005EE10 0C0195BC */ jal osRecvMesg +/* 3A214 8005EE14 24060001 */ addiu $a2, $zero, 1 +.L8005EE18: +/* 3A218 8005EE18 8FA50010 */ lw $a1, 0x10($sp) +/* 3A21C 8005EE1C 8CA40050 */ lw $a0, 0x50($a1) +/* 3A220 8005EE20 0C019608 */ jal osSendMesg +/* 3A224 8005EE24 24060001 */ addiu $a2, $zero, 1 +/* 3A228 8005EE28 08017B4D */ j .L8005ED34 +/* 3A22C 8005EE2C 0200202D */ daddu $a0, $s0, $zero diff --git a/asm/nonmatchings/os/code_43200_len_7c0/osMotorAccess.s b/asm/nonmatchings/os/code_43200_len_7c0/__osMotorAccess.s similarity index 99% rename from asm/nonmatchings/os/code_43200_len_7c0/osMotorAccess.s rename to asm/nonmatchings/os/code_43200_len_7c0/__osMotorAccess.s index 83b9b1cd9a..bbe23df549 100644 --- a/asm/nonmatchings/os/code_43200_len_7c0/osMotorAccess.s +++ b/asm/nonmatchings/os/code_43200_len_7c0/__osMotorAccess.s @@ -1,7 +1,7 @@ .set noat # allow manual use of $at .set noreorder # don't insert nops after branches -glabel osMotorAccess +glabel __osMotorAccess /* 43200 80067E00 27BDFFD8 */ addiu $sp, $sp, -0x28 /* 43204 80067E04 AFB10014 */ sw $s1, 0x14($sp) /* 43208 80067E08 00808821 */ addu $s1, $a0, $zero @@ -20,6 +20,7 @@ glabel osMotorAccess /* 4323C 80067E3C 00449021 */ addu $s2, $v0, $a0 /* 43240 80067E40 08019FCA */ j .L80067F28 /* 43244 80067E44 24020005 */ addiu $v0, $zero, 5 + .L80067E48: /* 43248 80067E48 0C019771 */ jal osSiGetAccess /* 4324C 80067E4C 00000000 */ nop diff --git a/asm/nonmatchings/os/code_3a850_le_a40/func_8005FDE4.s b/asm/nonmatchings/os/nuContRmbMgr/func_8005FDE4.s similarity index 100% rename from asm/nonmatchings/os/code_3a850_le_a40/func_8005FDE4.s rename to asm/nonmatchings/os/nuContRmbMgr/func_8005FDE4.s diff --git a/asm/nonmatchings/os/code_3a850_le_a40/func_8005FE0C.s b/asm/nonmatchings/os/nuContRmbMgr/func_8005FE0C.s similarity index 100% rename from asm/nonmatchings/os/code_3a850_le_a40/func_8005FE0C.s rename to asm/nonmatchings/os/nuContRmbMgr/func_8005FE0C.s diff --git a/asm/nonmatchings/os/code_3a850_le_a40/func_8005FE54.s b/asm/nonmatchings/os/nuContRmbMgr/func_8005FE54.s similarity index 100% rename from asm/nonmatchings/os/code_3a850_le_a40/func_8005FE54.s rename to asm/nonmatchings/os/nuContRmbMgr/func_8005FE54.s diff --git a/asm/nonmatchings/os/code_3a850_le_a40/nuContRmbMgrInit.s b/asm/nonmatchings/os/nuContRmbMgr/nuContRmbMgrInit.s similarity index 100% rename from asm/nonmatchings/os/code_3a850_le_a40/nuContRmbMgrInit.s rename to asm/nonmatchings/os/nuContRmbMgr/nuContRmbMgrInit.s diff --git a/asm/nonmatchings/os/code_3a6f0_len_110/nuGfxSetCfb.s b/asm/nonmatchings/os/nuGfxSetCfb/nuGfxSetCfb.s similarity index 100% rename from asm/nonmatchings/os/code_3a6f0_len_110/nuGfxSetCfb.s rename to asm/nonmatchings/os/nuGfxSetCfb/nuGfxSetCfb.s diff --git a/include/nu/nusys.h b/include/nu/nusys.h new file mode 100644 index 0000000000..b5cd46a06f --- /dev/null +++ b/include/nu/nusys.h @@ -0,0 +1,1052 @@ +/*======================================================================*/ +/* NuSYS */ +/* nusys.h */ +/* */ +/* Copyright (C) 1997, NINTENDO Co,Ltd. */ +/* */ +/*----------------------------------------------------------------------*/ +/* Ver 1.0 97/10/09 Created by Kensaku Ohki(SLANP) */ +/* Ver 1.2 98/07/12 Modified by Kensaku Ohki(SLANP) */ +/* Ver 2.0 90/01/23 Modified by Kensaku Ohki(SLANP) */ +/*----------------------------------------------------------------------*/ +/* $Id: nusys.h,v 1.21 1999/01/26 02:33:26 ohki Exp $ */ +/*======================================================================*/ +#ifndef _NUSYS_H_ +#define _NUSYS_H_ + +#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) + +#ifndef F3DEX_GBI +#define F3DEX_GBI +#endif /* F3DEX_GBI */ + +#include +#include +#endif + +#ifdef _LANGUAGE_C_PLUS_PLUS +extern "C" { +#endif + +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +/* DEFINE */ +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +#define NU_VERSION "1.0" + +/*--------------------------------------*/ +/* NuSystem spec define */ +/*--------------------------------------*/ +#define NU_SPEC_BOOT_STACK_SIZE 0x2000 +#define NU_SPEC_BOOT_ADDR 0x80025c00 +#define NU_SPEC_BOOT_STACK nuMainStack + NU_SPEC_BOOT_STACK_SIZE + +/*--------------------------------------*/ +/* Thread ID for DEBUG (a precaution) */ +/*--------------------------------------*/ +#define NU_IDLE_THREAD_ID 1 +#define NU_RMON_THERAD_ID 2 /* no use */ +#define NU_MAIN_THREAD_ID 3 + + +/*--------------------------------------*/ +/* NuSYS Thread Priority */ +/*--------------------------------------*/ +#define NU_IDLE_THREAD_PRI OS_PRIORITY_IDLE /* Idle thread */ +#define NU_RMON_THREAD_PRI OS_PRIORITY_RMON /* no use */ +#define NU_MAIN_THREAD_PRI 10 /* main thread */ + +/*--------------------------------------*/ +/* NUSYS STACK SIZE */ +/*--------------------------------------*/ +#define NU_IDLE_STACK_SIZE 0x2000 /* Idle thread */ +#define NU_MAIN_STACK_SIZE NU_SPEC_BOOT_STACK_SIZE /* Main thread */ + + + + +/*----------------------------------------------------------------------*/ +/* SCHEDULER DEFINE */ +/*----------------------------------------------------------------------*/ +#define NU_SC_STACK_SIZE 0x2000 /* Thread stack size */ +#define NU_SC_NOSWAPBUFFER 0x0000 /* No swap */ +#define NU_SC_SWAPBUFFER 0x0001 /* Swap frame buffer */ +#define NU_SC_NORDP 0x0002 /* Do not wait for RDP finish */ +#define NU_SC_UCODE_XBUS 0x0004 /* XBUS Ucode */ +#define NU_SC_TASK_YIELDED (OS_TASK_YIELEDE<<16) +#define NU_SC_TASK_DP_WAIT (OS_TASK_DP_WAIT<<16) /* RDP WAIT */ +#define NU_SC_TASK_LODABLE (OS_TASK_LOADBLE<<16) /* LOADABLE */ +#define NU_SC_TASK_SP_ONLY (OS_TASK_SP_ONLY<<16) /* SP ONLY */ + + +#define NU_SC_RETRACE_MSG 0x0001 /* Retrace message */ +#define NU_SC_PRENMI_MSG 0x0002 /* NMI message */ +#define NU_SC_SWAPBUFFER_MSG 0x0004 /* Swap frame buffer message*/ +#define NU_SC_GTASKEND_MSG 0x0008 /* Task finished message */ +#define NU_SC_MAX_MESGS 8 /* Message buffer size */ + +#define NU_SC_HANDLER_PRI 120 /* EVENT HANDLER THREAD PRORITY */ +#define NU_SC_AUDIO_PRI 110 /* AUDIO DISPATCHER THREAD PRORITY */ +#define NU_SC_GRAPHICS_PRI 100 /* GFX DISPATCHER THREAD PRORITY */ +#define NU_SC_PRENMI_YET 0 /* PRE NMI has not occurred. */ +#define NU_SC_PRENMI_GET 1 /* PRE NMI received flag */ +#define NU_SC_BEFORE_RESET 2 /* Pre-RESET flag for frame before reset */ +#define NU_SC_BEFORE_RESET_FRAME 2 /* Number of frames before reset where BEFORE_RESET flag is set. */ +/*----------------------------------------------------------------------*/ +/* GRAFIC THREAD DEFINE */ +/*----------------------------------------------------------------------*/ +#define NU_GFX_THREAD_ID 4 +#define NU_GFX_TASKMGR_THREAD_ID 5 +#define NU_GFX_STACK_SIZE 0x2000 /* Thread stack size */ +#define NU_GFX_MESGS 8 /* GFX message queue*/ +#define NU_GFX_TASKMGR_STACK_SIZE 0x2000 /* Stack size */ +#define NU_GFX_TASKMGR_MESGS 8 /*Task Manager queue*/ +#define NU_GFX_THREAD_PRI 50 /* GFX thread priority */ +#define NU_GFX_TASKMGR_THREAD_PRI 60 /* Task Manager priority */ + +/*----------------------------------------------------------------------*/ +/* GRAFIC MANEGER DEFINE */ +/*----------------------------------------------------------------------*/ +#ifdef F3DEX_GBI_2 +#define NU_GFX_UCODE_F3DEX2 0 /* F3DEX microcode */ +#define NU_GFX_UCODE_F3DEX2_NON 1 /* F3DEX.NoN microcode */ +#define NU_GFX_UCODE_F3DEX2_REJ 2 /* F3DEX.NoN microcode */ +#define NU_GFX_UCODE_F3DLX2_REJ 3 /* F3DEX.ReJ microcode */ +#define NU_GFX_UCODE_L3DEX2 4 /* L3DEX microcode */ +#define NU_GFX_UCODE_S2DEX2 5 /* S2DEX microcode */ + +#define NU_GFX_UCODE_F3DEX 0 /* For compatibility */ +#define NU_GFX_UCODE_F3DEX_NON 1 /* For compatibility */ +#define NU_GFX_UCODE_F3DLX 0 /* For compatibility */ +#define NU_GFX_UCODE_F3DLX_NON 1 /* For compatibility */ +#define NU_GFX_UCODE_F3DLX_REJ 4 /* For compatibility */ +#define NU_GFX_UCODE_F3DLP_REJ 3 /* For compatibility */ +#define NU_GFX_UCODE_L3DEX 4 /* For compatibility */ +#define NU_GFX_UCODE_S2DEX 5 /* For compatibility */ +#define NU_GFX_UCODE_S2DEX_D 5 /* For compatibility */ + +#else +#define NU_GFX_UCODE_F3DEX 0 /* F3DEX microcode */ +#define NU_GFX_UCODE_F3DEX_NON 1 /* F3DEX.NoN microcode */ +#define NU_GFX_UCODE_F3DLX 2 /* F3DLX microcode */ +#define NU_GFX_UCODE_F3DLX_NON 3 /* F3DLX.NoN microcode */ +#define NU_GFX_UCODE_F3DLX_REJ 4 /* F3DEX.ReJ microcode */ +#define NU_GFX_UCODE_F3DLP_REJ 5 /* F3DLP.Rej microcode */ +#define NU_GFX_UCODE_L3DEX 6 /* L3DEX microcode */ +#define NU_GFX_UCODE_S2DEX 7 /* S2DEX microcode */ +#define NU_GFX_UCODE_S2DEX_D 8 /* S2DEX microcode */ +#endif /* F3DEX_GBI_2 */ + + +/*--------------------------------------*/ +/* The number of graphics task structures */ +/* should be set to a value at least as large as the Scheduler*/ +/* message buffer size. */ +/* Otherwise, a task structure in use may */ +/* be used. */ +/*--------------------------------------*/ +#define NU_GFX_TASK_NUM 10 /* Number of graphics task structures */ +#define NU_GFX_RDP_OUTPUTBUFF_SIZE 0x20000 /* fifo buffer size */ + +/*--------------------------------------*/ +/* Default frame buffer */ +/* The default frame buffer */ +/* is the 320x240 16-bit triple */ +/* xxbuffer in the high-order */ +/* area of RDRAM.xx */ +/*--------------------------------------*/ +#define NU_GFX_FRAMEBUFFER_NUM 3 +#define NU_GFX_FRAMEBUFFER_ADDR (0x80400000-320*240*2*3) +#define NU_GFX_FRAMEBUFFER0_ADDR (NU_GFX_FRAMEBUFFER_ADDR) +#define NU_GFX_FRAMEBUFFER1_ADDR (NU_GFX_FRAMEBUFFER0_ADDR+320*240*2) +#define NU_GFX_FRAMEBUFFER2_ADDR (NU_GFX_FRAMEBUFFER1_ADDR+320*240*2) + +#define NU_GFX_INIT_SCREEN_WD 320 +#define NU_GFX_INIT_SCREEN_HT 240 + +/*--------------------------------------*/ +/* Default Z -buffer is located in */ +/* xxlow-order memory.xx */ +/*--------------------------------------*/ +#define NU_GFX_ZBUFFER_ADDR 0x80000400 + +#define NU_GFX_DISPLAY_OFF 0 /* No display */ +#define NU_GFX_DISPLAY_ON 1 /* Display */ +#define NU_GFX_DISPLAY_ON_TRIGGER 0x80 /* Trigger */ + + +/*----------------------------------------------------------------------*/ +/* SI MANAGER DEFINE */ +/*----------------------------------------------------------------------*/ +#define NU_SI_STACK_SIZE NU_CONT_STACK_SIZE +#define NU_SI_THREAD_ID NU_CONT_THREAD_ID +#define NU_SI_THREAD_PRI NU_CONT_THREAD_PRI +#define NU_SI_MESG_MAX NU_CONT_MESG_MAX +#define NU_SI_CALLBACK_END 1 +#define NU_SI_CALLBACK_CONTINUE 0 +#define NU_SI_SC_MAJOR_NO 0x0000 +#define NU_SI_MSG_MAJOR_NO_MASK 0xff00 +#define NU_SI_MSG_MINOR_NO_MASK 0x00ff + +#define NU_SI_MAJOR_NO_CONT 0x0100 +#define NU_SI_MAJOR_NO_PAK 0x0200 +#define NU_SI_MAJOR_NO_RMB 0x0300 +#define NU_SI_MAJOR_NO_EEPROM 0x0400 +#define NU_SI_MAJOR_NO_GBPAK 0x0500 +#define NU_SI_MAJOR_NO_VRS 0x0600 +#define NU_SI_STOP_MGR_MSG 0x7F00 + +/*----------------------------------------------------------------------*/ +/* CONTROLLER MANEGER DEFINE */ +/*----------------------------------------------------------------------*/ +#define NU_CONT_MAXCONTROLLERS MAXCONTROLLERS +#define NU_CONT_STACK_SIZE 0x2000 +#define NU_CONT_MESG_MAX 8 +#define NU_CONT_THREAD_ID 5 +#define NU_CONT_THREAD_PRI 115 +#define NU_CONT_DATA_UNLOCK 0 +#define NU_CONT_DATA_LOCK 1 + + +/*----------------------------------------------------------------------*/ +/* Define messages sent to the Controller Manager */ +/*----------------------------------------------------------------------*/ +#define NU_CONT_MSG_BASE NU_SI_MAJOR_NO_CONT +#define NU_CONT_RETRACE_MSG (NU_CONT_MSG_BASE+0) +#define NU_CONT_READ_MSG (NU_CONT_MSG_BASE+1) +#define NU_CONT_READ_NW_MSG (NU_CONT_MSG_BASE+2) +#define NU_CONT_QUERY_MSG (NU_CONT_MSG_BASE+3) + + +#define NU_CONT_PAK_MSG_BASE NU_SI_MAJOR_NO_PAK +#define NU_CONT_PAK_RETRACE_MSG (NU_CONT_PAK_MSG_BASE+0) +#define NU_CONT_PAK_OPEN_MSG (NU_CONT_PAK_MSG_BASE+1) +#define NU_CONT_PAK_FREE_MSG (NU_CONT_PAK_MSG_BASE+2) +#define NU_CONT_PAK_FOPEN_MSG (NU_CONT_PAK_MSG_BASE+3) +#define NU_CONT_PAK_READWRITE_MSG (NU_CONT_PAK_MSG_BASE+4) +#define NU_CONT_PAK_FILEDELETE_MSG (NU_CONT_PAK_MSG_BASE+5) +#define NU_CONT_PAK_FILESTATE_MSG (NU_CONT_PAK_MSG_BASE+6) +#define NU_CONT_PAK_FILENUM_MSG (NU_CONT_PAK_MSG_BASE+7) +#define NU_CONT_PAK_REPAIRID_MSG (NU_CONT_PAK_MSG_BASE+8) + +#define NU_CONT_PAK_MODE_NOCREATE 0 +#define NU_CONT_PAK_MODE_CREATE 1 +#define NU_CONT_PAK_TYPE_NONE 0 +#define NU_CONT_PAK_TYPE_PAK 1 /* Controller Pak */ +#define NU_CONT_PAK_TYPE_RUMBLE 2 /* Rumble Pak */ +#define NU_CONT_PAK_TYPE_GBPAK 3 /* 64GB Pak */ +#define NU_CONT_PAK_READ PFS_READ +#define NU_CONT_PAK_WRITE PFS_WRITE + +/*----------------------------------------------------------------------*/ +/* Rumble Pak control */ +/*----------------------------------------------------------------------*/ +#define NU_CONT_RMB_STATE_STOP 0x00 +#define NU_CONT_RMB_STATE_STOPPING 0x01 +#define NU_CONT_RMB_STATE_STOPPED 0x02 +#define NU_CONT_RMB_STATE_RUN 0x03 +#define NU_CONT_RMB_STATE_FORCESTOP 0x04 +#define NU_CONT_RMB_MODE_DISABLE 0x00 +#define NU_CONT_RMB_MODE_ENABLE 0x01 +#define NU_CONT_RMB_MODE_AUTORUN 0x02 +#define NU_CONT_RMB_MODE_PAUSE 0x80 +#define NU_CONT_RMB_AUTO_SEARCH 0x00 +#define NU_CONT_RMB_AUTO_FIND 0x01 +#define NU_CONT_RMB_AUTO_SEARCHTIME (60*5) +#define NU_CONT_RMB_MSG_BASE NU_SI_MAJOR_NO_RMB +#define NU_CONT_RMB_RETRACE_MSG (NU_CONT_RMB_MSG_BASE+0) +#define NU_CONT_RMB_CHECK_MSG (NU_CONT_RMB_MSG_BASE+1) +#define NU_CONT_RMB_START_MSG (NU_CONT_RMB_MSG_BASE+2) +#define NU_CONT_RMB_STOP_MSG (NU_CONT_RMB_MSG_BASE+3) +#define NU_CONT_RMB_FORCESTOP_MSG (NU_CONT_RMB_MSG_BASE+4) +#define NU_CONT_RMB_FORCESTOPEND_MSG (NU_CONT_RMB_MSG_BASE+5) + +/*----------------------------------------------------------------------*/ +/* EEPROM */ +/*----------------------------------------------------------------------*/ +#define NU_EEPROM_MSG_BASE NU_SI_MAJOR_NO_EEPROM +#define NU_EEPROM_RETRACE_MSG (NU_EEPROM_MSG_BASE+0) +#define NU_EEPROM_CHECK_MSG (NU_EEPROM_MSG_BASE+1) +#define NU_EEPROM_READ_MSG (NU_EEPROM_MSG_BASE+2) +#define NU_EEPROM_WRITE_MSG (NU_EEPROM_MSG_BASE+3) + + +/*----------------------------------------------------------------------*/ +/* 64GB Pack Manager */ +/*----------------------------------------------------------------------*/ +#define NU_CONT_GBPAK_MSG_BASE NU_SI_MAJOR_NO_GBPAK +#define NU_CONT_GBPAK_RETRACE_MSG (NU_CONT_GBPAK_MSG_BASE+0) +#define NU_CONT_GBPAK_OPEN_MSG (NU_CONT_GBPAK_MSG_BASE+1) +#define NU_CONT_GBPAK_STATUS_MSG (NU_CONT_GBPAK_MSG_BASE+2) +#define NU_CONT_GBPAK_POWER_MSG (NU_CONT_GBPAK_MSG_BASE+3) +#define NU_CONT_GBPAK_READID_MSG (NU_CONT_GBPAK_MSG_BASE+4) +#define NU_CONT_GBPAK_READWRITE_MSG (NU_CONT_GBPAK_MSG_BASE+5) +#define NU_CONT_GBPAK_CHECKCONNECTOR_MSG (NU_CONT_GBPAK_MSG_BASE+6) + +#define NU_CONT_GBPAK_POWER_OFF OS_GBPAK_POWER_OFF +#define NU_CONT_GBPAK_POWER_ON OS_GBPAK_POWER_ON +#define NU_CONT_GBPAK_MBC_RAM_ENABLE_CODE 0x0a +#define NU_CONT_GBPAK_MBC_RAM_DISABLE_CODE 0x00 +#define NU_CONT_GBPAK_MBC_RAM_REG0_ADDR 0x0000 + +#define NU_CONT_GBPAK_MBC_REG0_ADDR 0x0000 /* Register 0 */ +#define NU_CONT_GBPAK_MBC_REG1_ADDR 0x2100 /* Register 1 */ +#define NU_CONT_GBPAK_MBC_REG2_ADDR 0x4000 /* Register 2 */ +#define NU_CONT_GBPAK_MBC_REG3_ADDR 0x6000 /* Register 3 */ + +/*----------------------------------------------------------------------*/ +/* Voice Recognition System Manager */ +/*----------------------------------------------------------------------*/ +#define NU_VRS_MSG_BASE NU_SI_MAJOR_NO_VRS +#define NU_VRS_RETRACE_MSG (NU_VRS_MSG_BASE+0) +#define NU_VRS_OPEN_MSG (NU_VRS_MSG_BASE+1) +#define NU_VRS_CLEAR_DICTIONARY_MSG (NU_VRS_MSG_BASE+2) +#define NU_VRS_SET_WORD_MSG (NU_VRS_MSG_BASE+3) +#define NU_VRS_MASK_DICTIONARY_MSG (NU_VRS_MSG_BASE+4) +#define NU_VRS_START_READ_DATA_MSG (NU_VRS_MSG_BASE+5) +#define NU_VRS_GET_READ_DATA_MSG (NU_VRS_MSG_BASE+6) +#define NU_VRS_STOP_READ_DATA_MSG (NU_VRS_MSG_BASE+7) +#define NU_VRS_CONTROL_GAIN_MSG (NU_VRS_MSG_BASE+8) + +/*----------------------------------------------------------------------*/ +/* PI DEFINE */ +/*----------------------------------------------------------------------*/ +#define NU_PI_MESG_NUM 50 /* PI message buffer size */ +#define NU_PI_CART_BLOCK_READ_SIZE 0x4000 /* cart read block size */ + +/*----------------------------------------------------------------------*/ +/* DEBUG */ +/*----------------------------------------------------------------------*/ +#define NU_DEB_PERF_GFXTASK_CNT 8 /* Graphics task count */ +#define NU_DEB_PERF_AUTASK_CNT 4 /* Audio task count */ +#define NU_DEB_DP_CLOCK_CTR 0 /* RDP internal counter */ +#define NU_DEB_DP_CMD_CTR 1 /* CMD counter */ +#define NU_DEB_DP_PIPE_CTR 2 /* PIPE counter */ +#define NU_DEB_DP_TMEM_CTR 3 /* TMEM counter */ +#define NU_DEB_BAR_FRAME1 0 /* For the performance bar */ +#define NU_DEB_BAR_FRAME2 1 /* Maximum number displayed */ +#define NU_DEB_BAR_FRAME3 2 +#define NU_DEB_BAR_FRAME4 3 +#define NU_DEB_BAR_FRAME5 4 +#define NU_DEB_BAR_FRAME6 5 +#define NU_DEB_BAR_FRAME7 6 +#define NU_DEB_CON_ROW_MAX 40 /* Number of rows in console */ +#define NU_DEB_CON_COLUMN_MAX 30 /* Number of columns in console */ +#define NU_DEB_CON_TEXT_SIZE (NU_DEB_CON_ROW_MAX*NU_DEB_CON_COLUMN_MAX) +#define NU_DEB_CON_WIDTH 320 +#define NU_DEB_CON_WINDOW_NUM 4 +#define NU_DEB_CON_WINDOW0 0 +#define NU_DEB_CON_WINDOW1 1 +#define NU_DEB_CON_WINDOW2 2 +#define NU_DEB_CON_WINDOW3 3 +#define NU_DEB_CON_TEXT_BLACK 0 /* Black */ +#define NU_DEB_CON_TEXT_BLUE 1 /* Blue */ +#define NU_DEB_CON_TEXT_GREEN 2 /* Green */ +#define NU_DEB_CON_TEXT_CYAN 3 /* Cyan */ +#define NU_DEB_CON_TEXT_RED 4 /* Red */ +#define NU_DEB_CON_TEXT_MAGENTA 5 /* Magenta */ +#define NU_DEB_CON_TEXT_YELLOW 6 /* yellow */ +#define NU_DEB_CON_TEXT_WHITE 7 /* White */ +#define NU_DEB_CON_TEXT_LIGHTBLACK 8 /* Gray */ +#define NU_DEB_CON_TEXT_LIGHTBLUE 9 /* Bright Blue */ +#define NU_DEB_CON_TEXT_LIGTHBLUE 9 /* Bright Blue (misspelled) */ +#define NU_DEB_CON_TEXT_LIGHTGREEN 10 /* Bright Green */ +#define NU_DEB_CON_TEXT_LIGHTCYAN 11 /* Bright Cyan */ +#define NU_DEB_CON_TEXT_LIGHTRED 12 /* Bright Red */ +#define NU_DEB_CON_TEXT_LIGHTMAGENTA 13 /* Bright Magenta */ +#define NU_DEB_CON_TEXT_LIGHTYELLOW 14 /* Bright yellow */ +#define NU_DEB_CON_TEXT_LIGHTWHITE 15 /* White */ +#define NU_DEB_CON_ATTR_NORMAL 0x0 /* No attribute*/ +#define NU_DEB_CON_ATTR_BLINK 0x1 /* Blinking */ +#define NU_DEB_CON_ATTR_REVERSE 0x2 /* Highlight */ +#define NU_DEB_CON_SCROLL_ON 1 +#define NU_DEB_CON_SCROLL_OFF 0 +#define NU_DEB_CON_WINDOW_OFF 0 +#define NU_DEB_CON_WINDOW_ON 1 + +#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +/* structer define */ +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +/*--------------------------------------*/ +/* Scheduler sturcter */ +/*--------------------------------------*/ +typedef short NUScMsg; /* Scheduler message type */ + +typedef struct st_SCClient { /* Client list structure */ + struct st_SCClient* next; /* Pointer to next client */ + OSMesgQueue* msgQ; /* Message sent to client */ + NUScMsg msgType; /* Type of message */ + /* NU_SC_RETRACE_MSG or*/ + /* NU_SC_PRENMI_MSG */ +} NUScClient; + +typedef struct st_SCTask { /* Task structure */ + struct st_SCTask *next; + u32 state; + u32 flags; + void *framebuffer; /* For graphics tasks */ + OSTask list; + OSMesgQueue *msgQ; + OSMesg msg; +} NUScTask; + +typedef struct st_Sched { /* Define the Scheduler structure. */ + + /* message */ + NUScMsg retraceMsg; + NUScMsg prenmiMsg; + + /* Define the Task request queue. */ + OSMesgQueue audioRequestMQ; + OSMesg audioRequestBuf[NU_SC_MAX_MESGS]; + OSMesgQueue graphicsRequestMQ; + OSMesg graphicsRequestBuf[NU_SC_MAX_MESGS]; + + /* Define the message queue. */ + OSMesgQueue retraceMQ; + OSMesg retraceMsgBuf[NU_SC_MAX_MESGS]; + OSMesgQueue rspMQ; + OSMesg rspMsgBuf[NU_SC_MAX_MESGS]; + OSMesgQueue rdpMQ; + OSMesg rdpMsgBuf[NU_SC_MAX_MESGS]; + + /* Implement wait for next retrace. */ + OSMesgQueue waitMQ; + OSMesg waitMsgBuf[NU_SC_MAX_MESGS]; + + /* Define threads.*/ + OSThread schedulerThread; /* Main thread */ + OSThread audioThread; /* Audio */ + OSThread graphicsThread; /* Graphics */ + + /* client list */ + NUScClient *clientList; + + /* The graphics task being executed. */ + NUScTask *curGraphicsTask; + NUScTask *curAudioTask; + NUScTask *graphicsTaskSuspended; + + u32 retraceCount; + u8 frameRate; + u8 frameBufferNum; /* Number of frame buffers */ + + +} NUSched; + + +/*--------------------------------------*/ +/* ucode structure */ +/*--------------------------------------*/ +typedef struct st_Ucode { + u64* ucode; + u64* ucode_data; +} NUUcode; + +/*--------------------------------------*/ +/* CALL BACK Function typedef */ +/*--------------------------------------*/ +typedef void (*NUIdleFunc)(void); /* Pointer to the idle callback function */ +typedef void (*NUScPreNMIFunc)(void); /* Pointer to PRENMI callback function */ +typedef void (*NUGfxFunc)(u32); /* Pointer to the GFX retrace callback function */ +typedef void (*NUGfxPreNMIFunc)(void); /* Pointer to the GFX PRENMI callback function */ + +typedef void (*NUGfxSwapCfbFunc)(void*);/* Pointer to the SWAPBUF callback function */ +typedef void (*NUGfxTaskEndFunc)(void*);/* Pointer to the TASKEND callback function */ +typedef void (*NUContReadFunc)(u32); /* Pointer to the Controller end-read */ + /* callback function */ +typedef void (*NUContPakFunc)(void*); /* Controller Pak control function callback */ +typedef void (*NUContRmbFunc)(void*); /* Rumble Pak control function callback */ +typedef s32 (*NUCallBackFunc)(void*); /* Callback function */ + + +/*--------------------------------------*/ +/* SI Common message */ +/*--------------------------------------*/ +typedef struct st_SiCommonMesg { + NUScMsg mesg; + OSMesgQueue* rtnMesgQ; + s32 error; + void* dataPtr; +} NUSiCommonMesg; + +/*--------------------------------------*/ +/* controller typedef */ +/*--------------------------------------*/ +typedef struct st_ContRead { + NUScMsg mesg; /* Type of message */ + OSMesgQueue* rtnMesgQ; + OSContPad* pad; +} NUContReadMesg; + +typedef struct st_ContData { + u16 button; /* A,B,C,Z,L,R,START,PAD ,button */ + s8 stick_x; /* Range acutally used: -61 <= stick X <= 61 */ + s8 stick_y; /* Range actually used: -63 <= stick Y <= 63 */ + u8 errno; /* Error */ + u16 trigger; /* Button trigger data */ +} NUContData; + +typedef struct st_ContQuery { + NUScMsg mesg; + OSMesgQueue* rtnMesgQ; +} NUContQueryMesg; + + +typedef struct st_ContPakFile { + OSPfs *pfs; + s32 file_no; + s32 error; + u32 type; +} NUContPakFile; + + +typedef struct st_ContPakFreeMesg { + NUContPakFile* file; + s32 size; +} NUContPakFreeMesg; + +typedef struct st_ContPakFileOpenMesg { + NUContPakFile* file; + u8* noteName; + u8* extName; + s32 size; + s32 mode; +} NUContPakFileOpenMesg; + +typedef struct st_ContPakFileRWMesg { + NUContPakFile* file; + s32 offset; + s32 size; + u8 mode; + u8* buf; +} NUContPakFileRWMesg; + +typedef struct st_ContPakFileStateMesg { + NUContPakFile* file; + OSPfsState* state; +} NUContPakFileStateMesg; + +typedef struct st_ContPakFileNumMesg { + NUContPakFile* file; + s32* max_files; + s32* used_files; +} NUContPakFileNumMesg; + +typedef struct st_ContPakIsPlugMesg { + NUScMsg mesg; + OSMesgQueue* rtnMesgQ; + s32 error; + u8 bitPattern; +} NUContPakIsPlugMesg; + +typedef struct st_ContRmbCtl { + u16 freq; /* Vibration frequency */ + u16 frame; + u16 counter; + u8 state; + u8 mode; + u8 autorun; + u8 type; +} NUContRmbCtl; + +typedef struct st_ContRmbMesg { + u8 contNo; + s32 error; + void* data; +} NUContRmbMesg; + +typedef struct st_CallBackList { + struct st_CallBackList* next; + s32 (**func)(NUSiCommonMesg*); + u16 majorNo; + u8 funcNum; +} NUCallBackList; + +typedef struct st_EepromMesg { + void* dataPtr; + s32 error; + u8 address; + u16 dataLen; +} NUEepromMesg; + +typedef struct st_ContGBPakMesg { + NUContPakFile* handle; + s32 data[4]; +} NUContGBPakMesg; + +typedef OSVoiceHandle NUVrsHandle; + +typedef OSVoiceData NUVrsData; + +typedef struct stVrsMesg { + NUVrsHandle* vrsHandle; + s32 data[2]; +} NUVrsMesg; + +/*--------------------------------------*/ +/* Debug */ +/*--------------------------------------*/ +typedef struct st_GfxTaskTime { + s64 rspStart; /* RSPTask start time */ + s64 rspEnd; /* RSPTask end time */ + s64 rdpEnd; /* RDP end time */ + u32 dpCnt[4]; /* RDP internal counter */ +} NUDebTaskTime; + +typedef struct st_DebTaskPerf { + s64 retraceTime; /* retrace event time*/ + u8 gfxTaskCnt; /* Number of graphics tasks */ + u8 auTaskCnt; /* Number of audio tasks */ + u8 gfxTaskStart; + NUDebTaskTime gfxTaskTime[NU_DEB_PERF_GFXTASK_CNT]; + NUDebTaskTime auTaskTime[NU_DEB_PERF_AUTASK_CNT]; +} NUDebTaskPerf; + +/* Console window structure */ +typedef struct st_DebConWindow { + u8 windowFlag; /* On/off flag for console window display */ + u16 scroll; /* Scroll value */ + u8 scrollFlag; /* Scrolling enabled/disabled */ + u8 textColor; /* Character color */ + u8 attribute; /* Attribute */ + u16 posX; /* Column position for write */ + u16 posY; /* Line position for write */ + u16 index; /* Position for character buffer write */ + u16 winX; /* x-coordinate of console window display */ + u16 winY; /* y-coordinate of console window display */ + u16 winW; /* Number of columns in console display */ + u16 winH; /* Number of rows in console display */ + u16 text[NU_DEB_CON_TEXT_SIZE]; /* Character buffer*/ +} NUDebConWindow; + +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +/* extern variables */ +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ + +extern u8 nuRDPOutputBuf[NU_GFX_RDP_OUTPUTBUFF_SIZE]; +extern u8 nuDramStack[SP_DRAM_STACK_SIZE8]; +extern u8 nuYieldBuf[OS_YIELD_DATA_SIZE]; +extern NUSched nusched; /* Scheduler structure */ +extern OSMesgQueue nuGfxMesgQ; /* Graphics thread queue */ +extern u32 nuScRetraceCounter; /* Retrace counter */ +extern u8 nuScPreNMIFlag; +/*--------------------------------------*/ +/* graphics variables */ +/*--------------------------------------*/ +extern NUUcode* nuGfxUcode; /* Pointer to GFX microcode structure */ +extern u16** nuGfxCfb; /* Pointer to array of pointers to frame buffers */ +extern u16* nuGfxCfb_ptr; /* Pointer to to frame buffer */ +extern u32 nuGfxCfbNum; /* Number of frame buffers */ +extern u16* nuGfxZBuffer; /* Pointer to the Z buffer */ +extern volatile u32 nuGfxTaskSpool; /* Number of tasks in queue */ +extern u32 nuGfxDisplay; /* Display on/off flag */ +extern u32 nuGfxCfbCounter; /* For frame buffer swapping */ + +/*--------------------------------------*/ +/* controller Manager variables */ +/*--------------------------------------*/ +extern OSContStatus nuContStatus[NU_CONT_MAXCONTROLLERS]; +extern OSContPad nuContData[NU_CONT_MAXCONTROLLERS]; +extern u32 nuContNum; /* Number of controllers connected */ +extern u32 nuContDataLockKey; /* Lock Controller data. */ +extern OSMesgQueue nuContWaitMesgQ; /* Wait for Controller read */ +extern OSPfs nuContPfs[4]; +extern NUCallBackList nuContCallBack; +extern u16 nuContPakCompanyCode; /* Company code */ +extern u32 nuContPakGameCode; /* Game code */ +extern NUCallBackList nuContPakCallBack; + +/*--------------------------------------*/ +/* RUMBUL Manager variables */ +/*--------------------------------------*/ +extern NUContRmbCtl nuContRmbCtl[4]; +extern u32 nuContRmbSearchTime; +extern NUCallBackList nuContRmbCallBack; + + +/*--------------------------------------*/ +/* EEPROM Manager variables */ +/*--------------------------------------*/ +extern NUCallBackList nuEepromCallBack; + +/*--------------------------------------*/ +/* 64GBPack Manager variables */ +/*--------------------------------------*/ +extern NUCallBackList nuContGBPakCallBack; + +/*--------------------------------------*/ +/* VRS Manager variables */ +/*--------------------------------------*/ +extern NUCallBackList nuVrsCallBack; + +/*--------------------------------------*/ +/* si variables */ +/*--------------------------------------*/ +extern OSMesgQueue nuSiMesgQ; /* SI event message queue */ +extern OSMesgQueue nuSiMgrMesgQ; /* SI Manager queue */ +extern NUCallBackList* nuSiCallBackList;/* Callback function list */ + +/*--------------------------------------*/ +/* pi variables */ +/*--------------------------------------*/ +extern OSPiHandle* nuPiCartHandle; +extern OSPiHandle* nuPiSramHandle; + +/*--------------------------------------*/ +/* CALL BACK Function pointer */ +/*--------------------------------------*/ +extern NUIdleFunc nuIdleFunc; /* callback func pointer */ +extern NUScPreNMIFunc nuScPreNMIFunc; /* PRE NMI callback pointer */ +extern NUGfxSwapCfbFunc nuGfxSwapCfbFunc; /* swapbuf callback pointer */ +extern NUGfxFunc nuGfxFunc; /* callback pointer */ +extern NUGfxPreNMIFunc nuGfxPreNMIFunc; /* Callback pointer */ +extern NUGfxTaskEndFunc nuGfxTaskEndFunc; /* task end callback ptr */ +extern NUContReadFunc nuContReadFunc; /* When controller read ends */ + /* Callback function */ +/*--------------------------------------*/ +/* Debug */ +/*--------------------------------------*/ +extern NUDebTaskPerf* nuDebTaskPerfPtr; +extern NUDebConWindow nuDebConWin[]; + +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +/* Global Function */ +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +/*--------------------------------------*/ +/* Boot function */ +/*--------------------------------------*/ +extern void nuIdleFuncSet(void (*func)(void)); +extern void nuPreNMIFuncSet(NUScPreNMIFunc func); +/*--------------------------------------*/ +/* Scheduler function */ +/*--------------------------------------*/ +extern void nuScCreateScheduler(u8 videoMode, u8 numFields); +extern void nuScAddClient(NUScClient *c, OSMesgQueue *mq, NUScMsg msgType); +extern void nuScRemoveClient(NUScClient *client); +extern void nuScResetClientMesgType(NUScClient* client, NUScMsg msgType); +/* extern void nuPreNMIFuncSet(NUScPreNMIFunc func); redundant extern warning */ +extern OSMesgQueue* nuScGetGfxMQ(void); +extern OSMesgQueue* nuScGetAudioMQ(void); +extern void nuScSetFrameBufferNum(u8 frameBufferNum); +extern s32 nuScGetFrameRate(void); + +/*--------------------------------------*/ +/* graphic(GFX) Manager function */ +/*--------------------------------------*/ +extern void nuGfxInit(void); +extern void nuGfxInitEX2(void); +extern void nuGfxThreadStart(void); +extern void nuGfxTaskMgrInit(void); +extern void nuGfxTaskStart(Gfx *gfxList_ptr, u32 gfxListSize, u32 ucode, u32 flag); +extern void nuGfxFuncSet(NUGfxFunc func); +extern void nuGfxPreNMIFuncSet(NUGfxPreNMIFunc func); +extern void nuGfxSwapCfbFuncSet(NUGfxSwapCfbFunc func); +extern void nuGfxSetCfb(u16** framebuf, u32 framebufnum); +extern void nuGfxSwapCfb(void* framebuffer); + +extern void nuGfxTaskEndFuncSet(NUGfxTaskEndFunc func); +extern void nuGfxTaskAllEndWait(void); +extern void nuGfxRetraceWait(u32 retrace_num); +extern void nuGfxDisplayOff(void); +extern void nuGfxDisplayOn(void); + +/* #ifdef F3DEX_GBI_2 + #define nuGfxInit() nuGfxInitEX2() + #endif /* F3DEX_GBI_2 */ +/*--------------------------------------*/ +/* controller Manager function */ +/*--------------------------------------*/ +extern u8 nuContInit(void); +extern s32 nuContMgr(void* mesg); +extern u8 nuContMgrInit(void); +extern void nuContMgrRemove(void); +extern void nuContDataLock(void); +extern void nuContDataUnLock(void); +extern void nuContDataRead(OSContPad* pad); +extern void nuContDataReadWait(void); +extern void nuContDataReadStart(void); +extern void nuContDataGet(OSContPad* contdata, u32 padno); +extern void nuContDataGetAll(OSContPad* contdata); +extern void nuContDataGetEx(NUContData *contdata, u32 padno); +extern void nuContDataGetExAll(NUContData *contdata); +extern void nuContReadFuncSet(NUContReadFunc func); +extern void nuContQueryRead(void); +extern void nuContDataClose(void); +extern void nuContDataOpen(void); + +/*--------------------------------------*/ +/* controller pak function */ +/*--------------------------------------*/ +extern s32 nuContPakMgr(void* mesg_type); +extern void nuContPakMgrInit(void); +extern void nuContPakMgrRemove(void); +extern void nuContPakJisToN64(u8* src, u8* dest, u32 len); +extern void nuContPakN64ToJis(u8* src, u8* dest, u32 len); +extern s32 nuContPakOpen(NUContPakFile *file, u32 contNo); +extern s32 nuContPakGetFree(NUContPakFile *file); +extern void nuContPakCodeSet(u8* companyCode, u8* gameCode); +extern s32 nuContPakRepairId(NUContPakFile *file); +extern s32 nuContPakFileOpen(NUContPakFile *file, + u8* noteName,u8* extName, u32 mode, s32 size); +extern s32 nuContPakFileOpenJis(NUContPakFile *file, + u8* noteName,u8* extName, u32 mode, s32 size); +extern s32 nuContPakFileReadWrite(NUContPakFile *file, + s32 offset, s32 size,u8* buf, u32 mode); +extern s32 nuContPakFileDelete(NUContPakFile *file, u8* noteName, u8* extName); +extern s32 nuContPakFileDeleteJis(NUContPakFile *file, u8* noteName, u8* extName); +extern s32 nuContPakFileState(NUContPakFile *file, OSPfsState* state); +extern s32 nuContPakFileNum(NUContPakFile *file, + s32 *max_files, s32 *used_files); +extern s32 nuContPakFileFread(NUContPakFile *file, s32 offset, s32 size, u8* buf); + +/*--------------------------------------*/ +/* rumbler pak functions */ +/*--------------------------------------*/ +extern void nuContRmbMgrInit(void); +extern s32 nuContRmbMgr(void* mesg); +extern void nuContRmbMgrRemove(void); +extern void nuContRmbStart(u32 contNo, u16 freq, u16 frame); +extern void nuContRmbStop(u32 contNo); +extern s32 nuContRmbCheck(u32 contNo); +extern void nuContRmbModeSet(u32 contNo, u8 mode); +extern void nuContRmbForceStop(void); +extern void nuContRmbForceStopEnd(void); +extern void nuContRmbSearchTimeSet(u32 frame); + +/*--------------------------------------*/ +/* 64GB Pack functions */ +/*--------------------------------------*/ +extern s32 nuContGBPakMgr(void* mesg); +extern void nuContGBPakMgrInit(void); +extern void nuContGBPakMgrRemove(void); +extern s32 nuContGBPakOpen(NUContPakFile* handle, s32 contNo); +extern s32 nuContGBPakGetStatus(NUContPakFile* handle, u8* status); +extern s32 nuContGBPakReadID(NUContPakFile* handle, OSGbpakId* id, u8* status); +extern s32 nuContGBPakReadWrite(NUContPakFile* handle, u16 flag , u16 address, u8* buffer, u16 size); +extern s32 nuContGBPakPower(NUContPakFile* handle, s32 flag); +extern s32 nuContGBPakCheckConnector(NUContPakFile* handle, u8* status); +extern s32 nuContGBPakFread(NUContPakFile* handle, u16 address, u8* buffer, u16 size); + +extern s32 nuContGBPakFwrite(NUContPakFile* handle, u16 address, u8* buffer, u16 size); +extern s32 nuContGBPakRegWrite(NUContPakFile* handle, u16 addr, u8 data); + +/*--------------------------------------*/ +/* eeprom functions */ +/*--------------------------------------*/ +extern void nuEepromMgrInit(void); +extern s32 nuEepromMgr(void* mesg); +extern s32 nuEepromCheck(void); +extern void nuEepromMgrRemove(void); +extern s32 nuEepromRead(u8 address, u8* buffer,u16 len); +extern s32 nuEepromWrite(u8 address, u8* buffer,u16 len); + + +/*--------------------------------------*/ +/* pi functions */ +/*--------------------------------------*/ +extern void nuPiInit(void); +extern void nuPiReadRom(u32 rom_addr, void* buf_ptr, u32 size); +extern void nuPiInitSram(void); +extern void nuPiInitDDrom(void); +extern void nuPiReadWriteSram(u32 addr, void* buf_ptr, u32 size, s32 flag); + +/*--------------------------------------*/ +/* si functions */ +/*--------------------------------------*/ +extern u8 nuSiMgrInit(void); +extern void nuSiCallBackAdd(NUCallBackList* list); +extern void nuSiCallBackRemove(NUCallBackList* list); +extern s32 nuSiSendMesg(NUScMsg mesg, void* dataPtr); +extern void nuSiSendMesgNW(NUScMsg mesg, void* dataPtr); +extern void nuSiMgrStop(void); +extern void nuSiMgrRestart(void); +/*--------------------------------------*/ +/* si functions */ +/*--------------------------------------*/ +extern s32 nuVrsMgr(void *mesg); +extern void nuVrsMgrInit(void); +extern s32 nuVrsOpen(NUVrsHandle* handle, s32 contNo); +extern s32 nuVrsClearDictionary(NUVrsHandle* handle, u8 words); +extern s32 nuVrsSetWord(NUVrsHandle* handle, u8* word); +extern s32 nuVrsStartReadData(NUVrsHandle* handle); +extern s32 nuVrsGetReadData(NUVrsHandle* handle, NUVrsData* data); +extern s32 nuVrsStopReadData(NUVrsHandle* handle); +extern s32 nuVrsControlGain(NUVrsHandle* handle, s32 analog, s32 digital); +extern s32 nuVrsMaskDictionary(NUVrsHandle* handle, u8* maskpattern, s32 size); + +/*--------------------------------------*/ +/* dubug functions */ +/*--------------------------------------*/ +#ifdef NDEBUG +#define nuDebTaskPerfBar0(EX0 ,EX1 ,EX2) ((void)0) +#define nuDebTaskPerfBar1(EX0 ,EX1 ,EX2) ((void)0) +#define nuDebTaskPerfBar0EX2(EX0 ,EX1 ,EX2) ((void)0) +#define nuDebTaskPerfBar1EX2(EX0 ,EX1 ,EX2) ((void)0) +#else +extern void nuDebTaskPerfBar0(u32 frameNum, u32 y, u32 flag); +extern void nuDebTaskPerfBar1(u32 frameNum, u32 y, u32 flag); +extern void nuDebTaskPerfBar0EX2(u32 frameNum, u32 y, u32 flag); +extern void nuDebTaskPerfBar1EX2(u32 frameNum, u32 y, u32 flag); +#endif /* NDEBUG */ + +extern void nuDebConDisp(u32 flag); +extern void nuDebConDispEX2(u32 flag); +extern void nuDebConCPuts(u32 wndNo, const char *s); +extern void nuDebConInc(NUDebConWindow* conWin); +extern void nuDebConRtn(NUDebConWindow* conWin); +extern void nuDebConEsc(NUDebConWindow* conWin, char esc); +extern void nuDebConWindowSet(u32 wndNo, u32 winX , u32 winY, u32 width, u32 height); +extern void nuDebConWindowSize(u32 wndNo, u32 width, u32 height); +extern void nuDebConWindowPos(u32 wndNo, u32 winX , u32 winY); +extern void nuDebConTextColor(u32 wndNo, u32 color); +extern void nuDebConTextAttr(u32 wndNo, u32 attr); +extern void nuDebConTextPos(u32 wndNo, u32 posX, u32 posY); +extern void nuDebConScroll(u32 wndNo, u32 flag); +extern void nuDebConWindowShow(u32 wndNo, u32 flag); +extern void nuDebConClear(u32 wndNo); +extern void nuDebConPutc(u32 wndNo, u32 c); +extern void nuDebTaskPerfLoad(void); +extern void nuDebConPrintf(u32 wndNo, const char* fmt, ...); + +#ifdef F3DEX_GBI_2 +#define nuDebConDisp(flag) nuDebConDispEX2(flag) +#define nuDebTaskPerfBar0(a, b, c) nuDebTaskPerfBar0EX2(a, b, c) +#define nuDebTaskPerfBar1(a, b, c) nuDebTaskPerfBar1EX2(a, b, c) +#endif /* F3DEX_GBI_2 */ + +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +/* MACRO */ +/*----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Registers the graphics microcode */ +/* IN: Pointer to the graphics microcode NUUcode array */ +/*----------------------------------------------------------------------*/ +#define nuGfxSetUcode(ucode) \ +{ \ + nuGfxUcode = ucode; \ +} +/*----------------------------------------------------------------------*/ +/* Z buffer settings */ +/* IN: Pointer to the Z buffer */ +/*----------------------------------------------------------------------*/ +#define nuGfxSetZBuffer(ZBuf_p) \ +{ \ + nuGfxZBuffer = ZBuf_p; \ +} +/*----------------------------------------------------------------------*/ +/* Remove callback functions */ +/* IN: nothing */ +/*----------------------------------------------------------------------*/ +#define nuPreNmiFuncRemove() nuPreNmiFuncSet(NULL) +#define nuGfxFuncRemove() nuGfxFuncSet(NULL) +#define nuGfxPreNMIFuncRemove() nuGfxPreNMIFuncSet(NULL) +#define nuGfxSwapCfbFuncRemove() nuGfxSwapCfbFuncSet(NULL) +#define nuGfxTaskEndFuncRemove() nuGfxTaskEndFuncSet(NULL) +#define nuContReadFuncRemove() nuContReadFuncSet(NULL) + +/*----------------------------------------------------------------------*/ +/* nuContDataGet - Obtains Controller data */ +/* Obtains read data from the Controller Manager. */ +/* */ +/* IN: *contpad Pointer to the Controller structure */ +/* cont_no Controller number */ +/*----------------------------------------------------------------------*/ +#if 0 +#define nuContDataGet(contpad, cont_no) \ +{ \ + bcopy(&nuContData[cont_no], contpad, sizeof(OSContPad)); \ +} + +/*----------------------------------------------------------------------*/ +/* nuContDataGetAll - Obtains Controller data */ +/* Obtains read data from the Controller Manager. */ +/* Copies all 4 buffers. */ +/* IN: *contpad Pointer to the Controller structure */ +/* cont_no Controller number */ +/*----------------------------------------------------------------------*/ +#define nuContDataGetAll(contpad) \ +{ \ + bcopy(&nuContData[0], contpad, sizeof(OSContPad)*MAXCONTROLLERS);\ +} +#endif +/*----------------------------------------------------------------------*/ +/* nuContPakFileFind - Search node */ +/*----------------------------------------------------------------------*/ +#define nuContPakFileFind(file, nodeName, extName) \ + nuContPakFileOpen(file, nodeNname, extName, NU_CONT_PAK_NOCREAT, 0)\ + + +/*----------------------------------------------------------------------*/ +/* nuContPakFileFindJis - Search node */ +/*----------------------------------------------------------------------*/ +#define nuContPakFileFindJis(file, nodeName, extName) \ + nuContPakFileOpenJis(file, nodeNname, extName, NU_CONT_PAK_NOCREAT, 0)\ + +/*----------------------------------------------------------------------*/ +/* nuContPakFileRead - Read note */ +/*----------------------------------------------------------------------*/ +#define nuContPakFileRead(file, offset, size, buf) \ + nuContPakFileReadWrite(file, offset, size, buf, PFS_READ) \ + +/*----------------------------------------------------------------------*/ +/* nuContPakFileWrite - Read note */ +/*----------------------------------------------------------------------*/ +#define nuContPakFileWrite(file, offset, size, buf) \ + nuContPakFileReadWrite(file, offset, size, buf, PFS_WRITE) \ + +/*----------------------------------------------------------------------*/ +/* nuDebConPuts - String output (with newline) */ +/*----------------------------------------------------------------------*/ +#define nuDebConPuts(wndNo, s) \ +{ \ + nuDebConCPuts(wndNo, s); \ + nuDebConRtn(&nuDebConWin[wndNo]); \ +} + +/*----------------------------------------------------------------------*/ +/* nuContGBPakRead - Read from the GB cartridge */ +/*----------------------------------------------------------------------*/ +#define nuContGBPakRead(file, address, buf, size) \ + nuContGBPakReadWrite(file, OS_READ, address, buf, size) + +/*----------------------------------------------------------------------*/ +/* nuContGBPakWrite - Write to the GB cartridge */ +/*----------------------------------------------------------------------*/ +#define nuContGBPakWrite(file, address, buf, size) \ + nuContGBPakReadWrite(file, OS_WRITE, address, buf, size) + +/*----------------------------------------------------------------------*/ +/* nuPiReadSram - Read from SRAM */ +/*----------------------------------------------------------------------*/ +#define nuPiReadSram(addr, buf_ptr, size) \ + nuPiReadWriteSram(addr, buf_ptr, size, OS_READ) + +/*----------------------------------------------------------------------*/ +/* nuPiWriteSram - Write to SRAM */ +/*----------------------------------------------------------------------*/ +#define nuPiWriteSram(addr, buf_ptr, size) \ + nuPiReadWriteSram(addr, buf_ptr, size, OS_WRITE) + +/*----------------------------------------------------------------------*/ +/* Define voice recognition macros */ +/*----------------------------------------------------------------------*/ +#define nuVrsCheckWord osVoiceCheckWord +#define nuVrsCountSyllables osVoiceCountSyllables + +#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ +#ifdef _LANGUAGE_C_PLUS_PLUS +} +#endif +#endif /* _NUSYS_H_ */ diff --git a/include/variables.h b/include/variables.h index 593e150bf2..cd2be79142 100644 --- a/include/variables.h +++ b/include/variables.h @@ -119,6 +119,9 @@ extern UNK_TYPE D_80108558; extern UNK_TYPE D_8010F250; // play_sound state struct? extern s8 D_8010EBB0[]; +//nusys +extern OSPiHandle* carthandle; + extern SaveData gCurrentSaveFile; extern s32 D_802D9CA4; diff --git a/papermario.ld b/papermario.ld index 3d6ad7c9c6..3aa6ba946d 100644 --- a/papermario.ld +++ b/papermario.ld @@ -51,15 +51,22 @@ SECTIONS build/src/code_362a0_len_2f70.o(.text); build/src/code_39210_len_aa0.o(.text); build/src/os/code_39cb0_len_100.o(.text); - build/src/os/code_39db0_len_8a0.o(.text); - build/src/os/code_3a650_len_40.o(.text); - build/src/os/code_3a690_len_40.o(.text); - build/src/os/code_3a6d0_len_20.o(.text); - build/src/os/code_3a6f0_len_110.o(.text); - build/src/os/code_3a800_len_30.o(.text); - build/src/os/code_3a830_len_20.o(.text); - build/src/os/code_3a850_le_a40.o(.text); - build/src/os/code_3b290_len_100.o(.text); + build/src/os/nusys/nuSched.o(.text); + build/src/os/nusys/nuGfxFuncSet.o(.text); + build/src/os/nusys/nuGfxPreNMIFuncSet.o(.text); + build/src/os/nusys/nuGfxTaskAllEndWait.o(.text); + build/src/os/nusys/nuGfxSetCfb.o(.text); + build/src/os/nusys/nuGfxDisplayOff.o(.text); + build/src/os/nusys/nuGfxDisplayOn.o(.text); + build/src/os/nusys/nuPiInit.o(.text); + build/src/os/nusys/nuPiReadRom.o(.text); + build/src/os/nusys/nuGfxInit.o(.text); + build/src/os/nusys/nuContInit.o(.text); + build/src/os/nusys/nuContDataGet.o(.text); + build/src/os/nusys/nuContPakMgr.o(.text); + build/src/os/nusys/nuContRmbMgr.o(.text); + build/src/os/nusys/nuContRmbStart.o(.text); + build/src/os/nusys/nuContRmbCheck.o(.text); build/src/os/code_3b390_len_110.o(.text); build/src/os/code_3b4a0_len_270.o(.text); build/src/os/code_3b710_len_40.o(.text); diff --git a/src/os/code_39db0_len_8a0.c b/src/os/code_39db0_len_8a0.c deleted file mode 100644 index 74d513375e..0000000000 --- a/src/os/code_39db0_len_8a0.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "common.h" - -INCLUDE_ASM(s32, "os/code_39db0_len_8a0", nuScCreateScheduler); - -INCLUDE_ASM(s32, "os/code_39db0_len_8a0", nuScExecuteAudio); - -INCLUDE_ASM(s32, "os/code_39db0_len_8a0", nuScAddClient); - -INCLUDE_ASM(s32, "os/code_39db0_len_8a0", nuScRemoveClient); - -INCLUDE_ASM(s32, "os/code_39db0_len_8a0", nuScResetClientMesgType); - -INCLUDE_ASM(s32, "os/code_39db0_len_8a0", nuScGetGfxMQ); - -INCLUDE_ASM(s32, "os/code_39db0_len_8a0", nuScGetAudioMQ); - -INCLUDE_ASM(s32, "os/code_39db0_len_8a0", nuScSetFrameBufferNum); - -INCLUDE_ASM(s32, "os/code_39db0_len_8a0", nuScGetFrameRate); - -INCLUDE_ASM(s32, "os/code_39db0_len_8a0", nuScEventHandler); - -INCLUDE_ASM(s32, "os/code_39db0_len_8a0", nuScEventBroadcast); - -INCLUDE_ASM(s32, "os/code_39db0_len_8a0", nuScWaitTaskReady); diff --git a/src/os/code_3a650_len_40.c b/src/os/code_3a650_len_40.c deleted file mode 100644 index b7f8f3b5c4..0000000000 --- a/src/os/code_3a650_len_40.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "common.h" - -INCLUDE_ASM(s32, "os/code_3a650_len_40", nuGfxFuncSet); diff --git a/src/os/code_3a690_len_40.c b/src/os/code_3a690_len_40.c deleted file mode 100644 index 9bff4185bb..0000000000 --- a/src/os/code_3a690_len_40.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "common.h" - -INCLUDE_ASM(s32, "os/code_3a690_len_40", nuGfxPreNMIFuncSet); diff --git a/src/os/code_3a6d0_len_20.c b/src/os/code_3a6d0_len_20.c deleted file mode 100644 index 8cf605b336..0000000000 --- a/src/os/code_3a6d0_len_20.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "common.h" - -INCLUDE_ASM(s32, "os/code_3a6d0_len_20", nuGfxTaskAllEndWait); diff --git a/src/os/code_3a6f0_len_110.c b/src/os/code_3a6f0_len_110.c deleted file mode 100644 index 09c7bb7b09..0000000000 --- a/src/os/code_3a6f0_len_110.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "common.h" - -INCLUDE_ASM(s32, "os/code_3a6f0_len_110", nuGfxSetCfb); diff --git a/src/os/code_3a800_len_30.c b/src/os/code_3a800_len_30.c deleted file mode 100644 index b396df9c1b..0000000000 --- a/src/os/code_3a800_len_30.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "common.h" - -INCLUDE_ASM(s32, "os/code_3a800_len_30", nuGfxDisplayOff); diff --git a/src/os/code_3a830_len_20.c b/src/os/code_3a830_len_20.c deleted file mode 100644 index 865786c617..0000000000 --- a/src/os/code_3a830_len_20.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "common.h" - -INCLUDE_ASM(s32, "os/code_3a830_len_20", nuGfxDisplayOn); diff --git a/src/os/code_3a850_le_a40.c b/src/os/code_3a850_le_a40.c deleted file mode 100644 index e623dc422c..0000000000 --- a/src/os/code_3a850_le_a40.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "common.h" - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", nuPiInit); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", nuPiReadRom); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", nuGfxInit); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", nuContInit); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", nuContDataGet); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", nuContPakMgrInit); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", nuContPakMgrRemove); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", contPakOpen); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", contPakFree); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", contPakFileReadWrite); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", contPakFileOpen); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", contPakFileDelete); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", contPakFileState); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", contPakFileNum); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", contPakRepairId); - -#undef osMotorStop -INCLUDE_ASM(s32, "os/code_3a850_le_a40", osMotorStop, OSPfs* unk); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", contRmbControl); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", nuContRmbMgrInit); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", nuContRmbMgrRemove); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", contRmbCheckMesg); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", contRmbStartMesg); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", func_8005FDE4); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", func_8005FE0C); - -INCLUDE_ASM(s32, "os/code_3a850_le_a40", func_8005FE54); diff --git a/src/os/code_3b290_len_100.c b/src/os/code_3b290_len_100.c deleted file mode 100644 index 355f256e80..0000000000 --- a/src/os/code_3b290_len_100.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "common.h" - -INCLUDE_ASM(s32, "os/code_3b290_len_100", nuContRmbStart); - -INCLUDE_ASM(s32, "os/code_3b290_len_100", nuContRmbCheck); diff --git a/src/os/code_43200_len_7c0.c b/src/os/code_43200_len_7c0.c index fd475552d0..1f8faaec1a 100644 --- a/src/os/code_43200_len_7c0.c +++ b/src/os/code_43200_len_7c0.c @@ -1,6 +1,6 @@ #include "common.h" -INCLUDE_ASM(s32, "os/code_43200_len_7c0", osMotorAccess); +INCLUDE_ASM(s32, "os/code_43200_len_7c0", __osMotorAccess, OSPfs* pfs, s32 unk); INCLUDE_ASM(s32, "os/code_43200_len_7c0", osMotorInit, OSMesgQueue* queue, OSPfs* pfs, int unk); diff --git a/src/os/nusys/nuContDataGet.c b/src/os/nusys/nuContDataGet.c new file mode 100644 index 0000000000..ec4d30ebc4 --- /dev/null +++ b/src/os/nusys/nuContDataGet.c @@ -0,0 +1,8 @@ +#include "common.h" +#include "nu/nusys.h" + +void nuContDataGet(OSContPad* contdata, u32 padno) { + nuContDataClose(); + bcopy(&nuContData[padno], contdata, sizeof(OSContPad)); + nuContDataOpen(); +} diff --git a/src/os/nusys/nuContInit.c b/src/os/nusys/nuContInit.c new file mode 100644 index 0000000000..50026a7b4a --- /dev/null +++ b/src/os/nusys/nuContInit.c @@ -0,0 +1,11 @@ +#include "common.h" +#include "nu/nusys.h" + +u8 nuContInit(void) { + u8 contBits = nuSiMgrInit(); + + nuContMgrInit(); + nuContPakMgrInit(); + nuContRmbMgrInit(); + return contBits; +} diff --git a/src/os/nusys/nuContPakMgr.c b/src/os/nusys/nuContPakMgr.c new file mode 100644 index 0000000000..0c909cd211 --- /dev/null +++ b/src/os/nusys/nuContPakMgr.c @@ -0,0 +1,78 @@ +#include "common.h" +#include "nu/nusys.h" + +void nuContPakMgrInit(void) { + nuSiCallBackAdd(&nuContCallBack); +} + +void nuContPakMgrRemove(void) { + nuSiCallBackRemove(&nuContCallBack); +} + +static s32 contPakOpen(NUSiCommonMesg* mesg) { + s32 err; + NUContPakFile* file = (NUContPakFile*) mesg->dataPtr; + + file->type = NU_CONT_PAK_TYPE_NONE; + err = osPfsInitPak(&nuSiMesgQ, file->pfs, file->pfs->channel); + + if (err == 0) { + file->type = NU_CONT_PAK_TYPE_PAK; + } + + return err; +} + +static s32 contPakFree(NUSiCommonMesg* mesg) { + NUContPakFreeMesg* freeMesg = (NUContPakFreeMesg*) mesg->dataPtr; + + return osPfsFreeBlocks(freeMesg->file->pfs, &freeMesg->size); +} + +static s32 contPakFileReadWrite(NUSiCommonMesg* mesg) { + NUContPakFileRWMesg* rwMesg = (NUContPakFileRWMesg*) mesg->dataPtr; + + return osPfsReadWriteFile(rwMesg->file->pfs, rwMesg->file->file_no, rwMesg->mode, rwMesg->offset, rwMesg->size, + rwMesg->buf); +} + +static s32 contPakFileOpen(NUSiCommonMesg* mesg) { + NUContPakFileOpenMesg* openMesg = mesg->dataPtr; + NUContPakFile* file = openMesg->file; + s32 err; + + err = osPfsFindFile(file->pfs, nuContPakCompanyCode, nuContPakGameCode, openMesg->noteName, openMesg->extName, + &file->file_no); + if (err == PFS_ERR_INVALID) { + if (openMesg->mode == NU_CONT_PAK_MODE_CREATE) { + err = osPfsAllocateFile(file->pfs, nuContPakCompanyCode, nuContPakGameCode, openMesg->noteName, openMesg->extName, + openMesg->size, &file->file_no); + } + } + return err; +} + +static s32 contPakFileDelete(NUSiCommonMesg* mesg) { + NUContPakFileOpenMesg* openMesg = (NUContPakFileOpenMesg*) mesg->dataPtr; + + return osPfsDeleteFile(openMesg->file->pfs, nuContPakCompanyCode, nuContPakGameCode, openMesg->noteName, + openMesg->extName); +} + +static s32 contPakFileState(NUSiCommonMesg* mesg) { + NUContPakFileStateMesg* state = (NUContPakFileStateMesg*) mesg->dataPtr; + + return osPfsFileState(state->file->pfs, state->file->file_no, state->state); +} + +static s32 contPakFileNum(NUSiCommonMesg* mesg) { + NUContPakFileNumMesg* fileNum = (NUContPakFileNumMesg*) mesg->dataPtr; + + return osPfsNumFiles(fileNum->file->pfs, fileNum->max_files, fileNum->used_files); +} + +static s32 contPakRepairId(NUSiCommonMesg* mesg) { + NUContPakFile* file = (NUContPakFile*) mesg->dataPtr; + + return osPfsRepairId(file->pfs); +} diff --git a/src/os/nusys/nuContRmbCheck.c b/src/os/nusys/nuContRmbCheck.c new file mode 100644 index 0000000000..afbf6c05e2 --- /dev/null +++ b/src/os/nusys/nuContRmbCheck.c @@ -0,0 +1,21 @@ +#include "common.h" +#include "nu/nusys.h" + +s32 nuContRmbCheck(u32 contNo) { + NUContRmbMesg mesg; + s32 err; + OSIntMask mask; + + mesg.contNo = contNo; + err = nuSiSendMesg(NU_CONT_RMB_CHECK_MSG, &mesg); + mask = osSetIntMask(1); + + if (err == 0) { + nuContRmbCtl[contNo].type = NU_CONT_PAK_TYPE_RUMBLE; + } else { + nuContRmbCtl[contNo].type = NU_CONT_PAK_TYPE_NONE; + } + osSetIntMask(mask); + + return err; +} diff --git a/src/os/nusys/nuContRmbMgr.c b/src/os/nusys/nuContRmbMgr.c new file mode 100644 index 0000000000..76fc26520e --- /dev/null +++ b/src/os/nusys/nuContRmbMgr.c @@ -0,0 +1,162 @@ +#include "common.h" +#include "nu/nusys.h" + +static s32 contRmbControl(NUContRmbCtl* rmbCtl, u32 contNo) { + s32 ret = 0; + u32 cnt; + + switch (rmbCtl->state) { + case NU_CONT_RMB_STATE_STOPPED: + break; + + case NU_CONT_RMB_STATE_STOPPING: + if (rmbCtl->counter != 0) { + ret = osMotorStop(&nuContPfs[contNo]); + } else { + rmbCtl->state = NU_CONT_RMB_STATE_STOPPED; + } + rmbCtl->counter--; + break; + + case NU_CONT_RMB_STATE_RUN: + if (rmbCtl->frame > 0) { + rmbCtl->counter += rmbCtl->freq; + cnt = rmbCtl->counter >> 8; + rmbCtl->counter &= 0xFF; + if (cnt > 0) { + ret = osMotorStart(&nuContPfs[contNo]); + } else { + ret = osMotorStop(&nuContPfs[contNo]); + } + } else { + ret = osMotorStop(&nuContPfs[contNo]); + rmbCtl->state = NU_CONT_RMB_STATE_STOPPING; + rmbCtl->counter = 2; + } + rmbCtl->frame--; + break; + + case NU_CONT_RMB_STATE_FORCESTOP: + ret = osMotorInit(&nuSiMesgQ, &nuContPfs[contNo], contNo); + if (ret == 0) { + osMotorStop(&nuContPfs[contNo]); + } + rmbCtl->state = NU_CONT_RMB_STATE_STOPPING; + rmbCtl->counter = 2; + } + + return ret; +} + +static s32 contRmbRetrace(NUSiCommonMesg* mesg) { + u32 i; + NUContRmbCtl* cont; + + for (i = 0; i < NU_CONT_MAXCONTROLLERS; i++) { + cont = &nuContRmbCtl[i]; + switch (cont->mode) { + case NU_CONT_RMB_MODE_DISABLE: + break; + + case NU_CONT_RMB_MODE_ENABLE: + if (contRmbControl(cont, i)) { + cont->mode = NU_CONT_RMB_MODE_DISABLE; + } + break; + + case NU_CONT_RMB_MODE_AUTORUN: + if (cont->autorun == NU_CONT_RMB_AUTO_SEARCH) { + if ((cont->counter % nuContRmbSearchTime) == 0) { + if (osMotorInit(&nuSiMesgQ, &nuContPfs[i], i) == 0) { + cont->autorun = NU_CONT_RMB_AUTO_FIND; + cont->type = NU_CONT_PAK_TYPE_RUMBLE; + } + } + cont->counter++; + } else { + if (contRmbControl(cont, i)) { + cont->counter = i; + cont->autorun = NU_CONT_RMB_AUTO_SEARCH; + cont->type = NU_CONT_PAK_TYPE_NONE; + } + } + break; + + case (NU_CONT_RMB_MODE_ENABLE | NU_CONT_RMB_MODE_PAUSE): + case (NU_CONT_RMB_MODE_AUTORUN | NU_CONT_RMB_MODE_PAUSE): + if (cont->type == NU_CONT_PAK_TYPE_RUMBLE) { + contRmbControl(cont, i); + } + } + } + + return 0; +} + + +#ifdef NON_MATCHING +// Will match when data is decompiled. +void nuContRmbMgrInit(void) { + u32 i; + + for (i = 0; i < NU_CONT_MAXCONTROLLERS; i++) { + nuContRmbCtl[i].state = NU_CONT_RMB_STATE_STOPPED; + nuContRmbCtl[i].mode = NU_CONT_RMB_MODE_DISABLE; + nuContRmbCtl[i].counter = i; + } + + nuSiCallBackAdd(&nuContRmbCallBack); +} +#else +INCLUDE_ASM(void, "os/nuContRmbMgr", nuContRmbMgrInit); +#endif + +void nuContRmbMgrRemove(void) { + nuSiCallBackRemove(&nuContRmbCallBack); +} + +static s32 contRmbCheckMesg(NUSiCommonMesg* mesg) { + NUContRmbMesg* rmbMesg = (NUContRmbMesg*) mesg->dataPtr; + + return osMotorInit(&nuSiMesgQ, &nuContPfs[rmbMesg->contNo], rmbMesg->contNo); +} + +static s32 contRmbStartMesg(NUSiCommonMesg* mesg) { + NUContRmbMesg* rmbMesg = (NUContRmbMesg*) mesg->dataPtr; + NUContRmbCtl* rmbCtl = (NUContRmbCtl*) rmbMesg->data; + + nuContRmbCtl[rmbMesg->contNo].state = rmbCtl->state; + nuContRmbCtl[rmbMesg->contNo].frame = rmbCtl->frame; + nuContRmbCtl[rmbMesg->contNo].freq = rmbCtl->freq; + nuContRmbCtl[rmbMesg->contNo].counter = 0; + return 0; +} + +static s32 contRmbStopMesg(NUSiCommonMesg* mesg) { + NUContRmbMesg* rmbMesg = (NUContRmbMesg*) mesg->dataPtr; + + nuContRmbCtl[rmbMesg->contNo].frame = 0; + + return 0; +} + +static s32 contRmbForceStopMesg(NUSiCommonMesg* mesg) { + u32 i; + + for (i = 0; i < NU_CONT_MAXCONTROLLERS; i++) { + nuContRmbCtl[i].state = NU_CONT_RMB_STATE_FORCESTOP; + nuContRmbCtl[i].mode |= NU_CONT_RMB_MODE_PAUSE; + } + + return 0; +} + +s32 contRmbForceStopEndMesg(NUSiCommonMesg* mesg) { + u32 i; + + for (i = 0; i < NU_CONT_MAXCONTROLLERS; i++) { + nuContRmbCtl[i].mode &= ~NU_CONT_RMB_MODE_PAUSE; + } + + return 0; +} diff --git a/src/os/nusys/nuContRmbStart.c b/src/os/nusys/nuContRmbStart.c new file mode 100644 index 0000000000..9826c374a4 --- /dev/null +++ b/src/os/nusys/nuContRmbStart.c @@ -0,0 +1,16 @@ +#include "common.h" +#include "nu/nusys.h" + +void nuContRmbStart(u32 contNo, u16 freq, u16 frame) { + NUContRmbCtl ctl; + NUContRmbMesg mesg; + + if (!(nuContRmbCtl[contNo].mode & NU_CONT_RMB_MODE_PAUSE)) { + ctl.state = NU_CONT_RMB_STATE_RUN; + ctl.freq = freq; + ctl.frame = frame; + mesg.data = &ctl; + mesg.contNo = contNo; + nuSiSendMesg(NU_CONT_RMB_START_MSG, &mesg); + } +} diff --git a/src/os/nusys/nuGfxDisplayOff.c b/src/os/nusys/nuGfxDisplayOff.c new file mode 100644 index 0000000000..8d3bb32ef6 --- /dev/null +++ b/src/os/nusys/nuGfxDisplayOff.c @@ -0,0 +1,7 @@ +#include "common.h" +#include "nu/nusys.h" + +void nuGfxDisplayOff(void) { + nuGfxDisplay = NU_GFX_DISPLAY_OFF; + osViBlack(TRUE); +} diff --git a/src/os/nusys/nuGfxDisplayOn.c b/src/os/nusys/nuGfxDisplayOn.c new file mode 100644 index 0000000000..4c53ade8cc --- /dev/null +++ b/src/os/nusys/nuGfxDisplayOn.c @@ -0,0 +1,6 @@ +#include "common.h" +#include "nu/nusys.h" + +void nuGfxDisplayOn(void) { + nuGfxDisplay = NU_GFX_DISPLAY_ON_TRIGGER; +} diff --git a/src/os/nusys/nuGfxFuncSet.c b/src/os/nusys/nuGfxFuncSet.c new file mode 100644 index 0000000000..e833fb522d --- /dev/null +++ b/src/os/nusys/nuGfxFuncSet.c @@ -0,0 +1,11 @@ +#include "common.h" +#include "nu/nusys.h" + +void nuGfxFuncSet(NUGfxFunc func) { + OSIntMask intMask; + + nuGfxTaskAllEndWait(); + intMask = osSetIntMask(OS_IM_NONE); + nuGfxFunc = func; + osSetIntMask(intMask); +} diff --git a/src/os/nusys/nuGfxInit.c b/src/os/nusys/nuGfxInit.c new file mode 100644 index 0000000000..c9ce45a724 --- /dev/null +++ b/src/os/nusys/nuGfxInit.c @@ -0,0 +1,28 @@ +#include "common.h" +#include "nu/nusys.h" + +extern u16* FrameBuf[3]; +extern UNK_PTR D_8009A610; +extern UNK_PTR D_80093BA0; +extern Gfx rdpstateinit_dl[]; + +void nuGfxInit(void) { + Gfx gfx[0x100]; + Gfx* ptr; + + nuGfxThreadStart(); + nuGfxSetCfb(FrameBuf, NU_GFX_FRAMEBUFFER_NUM); + nuGfxSetZBuffer((u16*) NU_GFX_ZBUFFER_ADDR); + nuGfxSwapCfbFuncSet(nuGfxSwapCfb); + D_8009A610 = &D_80093BA0; + nuGfxTaskMgrInit(); + + ptr = gfx; + // TODO: Verify that this macro call works in PM64. + gSPDisplayList(ptr++, OS_K0_TO_PHYSICAL(&rdpstateinit_dl)); + gDPFullSync(ptr++); + gSPEndDisplayList(ptr++); + + nuGfxTaskStart(gfx, (s32)(ptr - gfx) * sizeof(Gfx), NU_GFX_UCODE_F3DEX, NU_SC_NOSWAPBUFFER); + nuGfxTaskAllEndWait(); +} diff --git a/src/os/nusys/nuGfxPreNMIFuncSet.c b/src/os/nusys/nuGfxPreNMIFuncSet.c new file mode 100644 index 0000000000..9d88253261 --- /dev/null +++ b/src/os/nusys/nuGfxPreNMIFuncSet.c @@ -0,0 +1,9 @@ +#include "common.h" +#include "nu/nusys.h" + +void nuGfxPreNMIFuncSet(NUGfxPreNMIFunc func) { + OSIntMask intMask = osSetIntMask(OS_IM_NONE); + + nuGfxPreNMIFunc = func; + osSetIntMask(intMask); +} diff --git a/src/os/nusys/nuGfxSetCfb.c b/src/os/nusys/nuGfxSetCfb.c new file mode 100644 index 0000000000..7822178a42 --- /dev/null +++ b/src/os/nusys/nuGfxSetCfb.c @@ -0,0 +1,3 @@ +#include "common.h" + +INCLUDE_ASM(void, "os/nuGfxSetCfb", nuGfxSetCfb); diff --git a/src/os/nusys/nuGfxTaskAllEndWait.c b/src/os/nusys/nuGfxTaskAllEndWait.c new file mode 100644 index 0000000000..bd516c7c52 --- /dev/null +++ b/src/os/nusys/nuGfxTaskAllEndWait.c @@ -0,0 +1,7 @@ +#include "common.h" +#include "nu/nusys.h" + +void nuGfxTaskAllEndWait(void) { + while (nuGfxTaskSpool) { + } +} diff --git a/src/os/nusys/nuPiInit.c b/src/os/nusys/nuPiInit.c new file mode 100644 index 0000000000..bf4011e9d5 --- /dev/null +++ b/src/os/nusys/nuPiInit.c @@ -0,0 +1,10 @@ +#include "common.h" +#include "nu/nusys.h" + +extern OSMesgQueue D_800AC5D0; +extern OSMesg D_800AC5E8[NU_PI_MESG_NUM]; + +void nuPiInit(void) { + osCreatePiManager(OS_PRIORITY_PIMGR, &D_800AC5D0, D_800AC5E8, NU_PI_MESG_NUM); + carthandle = osCartRomInit(); +} diff --git a/src/os/nusys/nuPiReadRom.c b/src/os/nusys/nuPiReadRom.c new file mode 100644 index 0000000000..321a3ea339 --- /dev/null +++ b/src/os/nusys/nuPiReadRom.c @@ -0,0 +1,35 @@ +#include "common.h" +#include "nu/nusys.h" + +void nuPiReadRom(u32 rom_addr, void* buf_ptr, u32 size) { + OSIoMesg ioMesg; + OSMesg mesg; + OSMesgQueue queue; + u32 mesgSize; + + osCreateMesgQueue(&queue, &mesg, 1); + + ioMesg.hdr.pri = OS_MESG_PRI_NORMAL; + ioMesg.hdr.retQueue = &queue; + osInvalDCache(buf_ptr, size); + osInvalICache(buf_ptr, size); + + while (size != 0) { + mesgSize = size; + + if (size > 0x4000) { + mesgSize = 0x4000; + } + + ioMesg.dramAddr = buf_ptr; + ioMesg.devAddr = rom_addr; + ioMesg.size = mesgSize; + + osEPiStartDma(carthandle, &ioMesg, OS_READ); + osRecvMesg(&queue, &mesg, OS_MESG_BLOCK); + + rom_addr += mesgSize; + buf_ptr += mesgSize; + size -= mesgSize; + } +} diff --git a/src/os/nusys/nuSched.c b/src/os/nusys/nuSched.c new file mode 100644 index 0000000000..f19d3e4056 --- /dev/null +++ b/src/os/nusys/nuSched.c @@ -0,0 +1,162 @@ +#include "common.h" +#include "nu/nusys.h" + +void nuScEventHandler(void); +void nuScExecuteAudio(void); +void nuScExecuteGraphics(void); + +extern u8 D_8009A5B0; + +extern u64 nuScStack[NU_SC_STACK_SIZE / sizeof(u64)]; +extern u64 nuScAudioStack[NU_SC_STACK_SIZE / sizeof(u64)]; +extern u64 nuScGraphicsStack[NU_SC_STACK_SIZE / sizeof(u64)]; + +void nuScCreateScheduler(u8 videoMode, u8 numFields) { + nusched.curGraphicsTask = NULL; + nusched.curAudioTask = NULL; + nusched.graphicsTaskSuspended = NULL; + nusched.clientList = NULL; + + nusched.retraceMsg = NU_SC_RETRACE_MSG; + nusched.prenmiMsg = NU_SC_PRENMI_MSG; + nusched.retraceCount = numFields; + nusched.frameBufferNum = 2; + + if (osTvType == OS_TV_PAL) { + nusched.frameRate = 50; + } else { + nusched.frameRate = 60; + } + + D_8009A5B0 = 0; + + osCreateMesgQueue(&nusched.retraceMQ, nusched.retraceMsgBuf, NU_SC_MAX_MESGS); + osCreateMesgQueue(&nusched.rspMQ, nusched.rspMsgBuf, NU_SC_MAX_MESGS); + osCreateMesgQueue(&nusched.rdpMQ, nusched.rdpMsgBuf, NU_SC_MAX_MESGS); + osCreateMesgQueue(&nusched.graphicsRequestMQ, nusched.graphicsRequestBuf, NU_SC_MAX_MESGS); + osCreateMesgQueue(&nusched.audioRequestMQ, nusched.audioRequestBuf, NU_SC_MAX_MESGS); + osCreateMesgQueue(&nusched.waitMQ, nusched.waitMsgBuf, NU_SC_MAX_MESGS); + + osCreateViManager(0xFE); + osViSetMode(&osViModeTable[videoMode]); + osViBlack(TRUE); + osViSetEvent(&nusched.retraceMQ, (OSMesg) 0x29A, numFields); + + osSetEventMesg(OS_EVENT_SP, &nusched.rspMQ, (OSMesg) 0x29B); + osSetEventMesg(OS_EVENT_DP, &nusched.rdpMQ, (OSMesg) 0x29C); + osSetEventMesg(OS_EVENT_PRENMI, &nusched.retraceMQ, (OSMesg) 0x29D); + + osCreateThread(&nusched.schedulerThread, 19, (void(*)) nuScEventHandler, &nusched, + nuScStack + NU_SC_STACK_SIZE / sizeof(u64), NU_SC_HANDLER_PRI); + osStartThread(&nusched.schedulerThread); + + osCreateThread(&nusched.audioThread, 18, (void(*)) nuScExecuteAudio, &nusched, + nuScAudioStack + NU_SC_STACK_SIZE / sizeof(u64), NU_SC_AUDIO_PRI); + osStartThread(&nusched.audioThread); + + osCreateThread(&nusched.graphicsThread, 17, (void(*)) nuScExecuteGraphics, &nusched, + nuScGraphicsStack + NU_SC_STACK_SIZE / sizeof(u64), NU_SC_GRAPHICS_PRI); + osStartThread(&nusched.graphicsThread); +} + +INCLUDE_ASM(void, "os/code_39db0_len_8a0", nuScExecuteAudio); + +INCLUDE_ASM(void, "os/code_39db0_len_8a0", nuScExecuteGraphics); + +void nuScAddClient(NUScClient* c, OSMesgQueue* mq, NUScMsg msgType) { + s32 mask; + + mask = osSetIntMask(OS_IM_NONE); + + c->msgQ = mq; + c->next = nusched.clientList; + c->msgType = msgType; + + nusched.clientList = c; + + if ((msgType & NU_SC_PRENMI_MSG) && D_8009A5B0) { + osSendMesg(mq, &nusched.prenmiMsg, OS_MESG_NOBLOCK); + } + + osSetIntMask(mask); +} + +void nuScRemoveClient(NUScClient* client) { + s32 mask = osSetIntMask(OS_IM_NONE); + NUScClient* clientList = nusched.clientList; + NUScClient* prev = NULL; + + while (clientList != NULL) { + if (clientList == client) { + if (prev != NULL) { + prev->next = clientList->next; + } else { + nusched.clientList = clientList->next; + } + break; + } + prev = clientList; + clientList = clientList->next; + } + + osSetIntMask(mask); +} + +void nuScResetClientMesgType(NUScClient* client, NUScMsg msgType) { + s32 mask; + + mask = osSetIntMask(OS_IM_NONE); + client->msgType = msgType; + osSetIntMask(mask); +} + +#ifdef NON_MATCHING +// This should match when data is decompiled. +OSMesgQueue* nuScGetGfxMQ(void) { + return &nusched.graphicsRequestMQ; +} +#else +INCLUDE_ASM(OSMesgQueue*, "os/code_39db0_len_8a0", nuScGetGfxMQ, void); +#endif + +#ifdef NON_MATCHING +// This should match when data is decompiled. +OSMesgQueue* nuScGetAudioMQ(void) { + return &nusched.audioRequestMQ; +} +#else +INCLUDE_ASM(OSMesgQueue*, "os/code_39db0_len_8a0", nuScGetAudioMQ, void); +#endif + +#ifdef NON_MATCHING +// This should match when data is decompiled. +void nuScSetFrameBufferNum(u8 frameBufferNum) { + nusched.frameBufferNum = frameBufferNum; +} +#else +INCLUDE_ASM(void, "os/code_39db0_len_8a0", nuScSetFrameBufferNum, u8 frameBufferNum); +#endif + +#ifdef NON_MATCHING +// This should match when data is decompiled. +s32 nuScGetFrameRate(void) { + return nusched.frameRate; +} +#else +INCLUDE_ASM(s32, "os/code_39db0_len_8a0", nuScGetFrameRate, void); +#endif + +INCLUDE_ASM(void, "os/code_39db0_len_8a0", nuScEventHandler); + +static void nuScEventBroadcast(NUScMsg* msg) { + NUScClient* clientList = nusched.clientList; + + while (clientList != NULL) { + if (clientList->msgType & *msg) { + osSendMesg(clientList->msgQ, msg, OS_MESG_NOBLOCK); + } + clientList = clientList->next; + } +} + +INCLUDE_ASM(void, "os/code_39db0_len_8a0", nuScWaitTaskReady); diff --git a/tools/splat.yaml b/tools/splat.yaml index 30072bbd45..bcd3f8f3a4 100644 --- a/tools/splat.yaml +++ b/tools/splat.yaml @@ -61,15 +61,22 @@ segments: - [0x362a0, "c", "code_362a0_len_2f70"] - [0x39210, "c", "code_39210_len_aa0"] - [0x39cb0, "c", "os/code_39cb0_len_100"] - - [0x39db0, "c", "os/code_39db0_len_8a0"] - - [0x3a650, "c", "os/code_3a650_len_40"] - - [0x3a690, "c", "os/code_3a690_len_40"] - - [0x3a6d0, "c", "os/code_3a6d0_len_20"] - - [0x3a6f0, "c", "os/code_3a6f0_len_110"] - - [0x3a800, "c", "os/code_3a800_len_30"] - - [0x3a830, "c", "os/code_3a830_len_20"] - - [0x3a850, "c", "os/code_3a850_le_a40"] - - [0x3b290, "c", "os/code_3b290_len_100"] + - [0x39db0, "c", "os/nusys/nuSched"] + - [0x3a650, "c", "os/nusys/nuGfxFuncSet"] + - [0x3a690, "c", "os/nusys/nuGfxPreNMIFuncSet"] + - [0x3a6d0, "c", "os/nusys/nuGfxTaskAllEndWait"] + - [0x3a6f0, "c", "os/nusys/nuGfxSetCfb"] + - [0x3a800, "c", "os/nusys/nuGfxDisplayOff"] + - [0x3a830, "c", "os/nusys/nuGfxDisplayOn"] + - [0x3a850, "c", "os/nusys/nuPiInit"] + - [0x3a890, "c", "os/nusys/nuPiReadRom"] + - [0x3a960, "c", "os/nusys/nuGfxInit"] + - [0x3aa10, "c", "os/nusys/nuContInit"] + - [0x3aa50, "c", "os/nusys/nuContDataGet"] + - [0x3aab0, "c", "os/nusys/nuContPakMgr"] + - [0x3af10, "c", "os/nusys/nuContRmbMgr"] + - [0x3b290, "c", "os/nusys/nuContRmbStart"] + - [0x3b2f0, "c", "os/nusys/nuContRmbCheck"] - [0x3b390, "c", "os/code_3b390_len_110"] - [0x3b4a0, "c", "os/code_3b4a0_len_270"] - [0x3b710, "c", "os/code_3b710_len_40"] diff --git a/tools/star-rod b/tools/star-rod index 3a32d3d6dd..9df51d2962 160000 --- a/tools/star-rod +++ b/tools/star-rod @@ -1 +1 @@ -Subproject commit 3a32d3d6dda7374e4f32ae86530444e45956d803 +Subproject commit 9df51d29626ffae94ff7ed03c252c24e71430105 diff --git a/undefined_syms.txt b/undefined_syms.txt index 0cc32751ca..7090fc2e47 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1,3 +1,5 @@ +osTvType = 0x80000300; + gGameStatusPtr = 0x8007419C; gRandSeed = 0x80074410; gUIStatus = 0x8010EF58; @@ -58,9 +60,31 @@ D_00102610_end = 0x0010CC10; D_0010CC10 = 0x0010CC10; D_0010CC10_end = 0x0010F1B0; D_80074021 = 0x80074021; + +gCurrentCameraID = 0x80077410; +D_80093BA0 = 0x80093BA0; +FrameBuf = 0x80093BA8; +rdpstateinit_dl = 0x80093BB8; +nuContPakCompanyCode = 0x80093CA0; +nuContPakGameCode = 0x80093CA4; +nuContCallBack = 0x80093CD0; +nuContRmbSearchTime = 0x80093CE0; +nuContRmbCallBack = 0x80093D00; +nuGfxFunc = 0x80093D10; +nuGfxPreNMIFunc = 0x80093D14; + +osViModeTable = 0x800946A0; D_800959D4 = 0x800959D4; +D_8009A5B0 = 0x8009A5B0; D_8009A5D8 = 0x8009A5D8; +nuGfxZBuffer = 0x8009A5DC; +nuGfxDisplay = 0x8009A5F8; gGameState = 0x8009A600; +D_8009A610 = 0x8009A610; + +nuGfxTaskSpool = 0x8009A618; +carthandle = 0x8009A638; + D_8009A650 = 0x8009A650; D_8009A6A0 = 0x8009A6A0; D_8009A6A2 = 0x8009A6A2; @@ -74,12 +98,27 @@ D_8009BA9C = 0x8009BA9C; D_8009BAA0 = 0x8009BAA0; D_800A0900 = 0x800A0900; +nuScStack = 0x800A65D0; +nuScAudioStack = 0x800A85D0; +nuScGraphicsStack = 0x800AA5D0; +D_800AC5D0 = 0x800AC5D0; +D_800AC5E8 = 0x800AC5E8; + gCurrentEncounter = 0x800B0F10; +nuContRmbCtl = 0x800B1d40; +nuContData = 0x800B1D68; gCameras = 0x800B1D80; + +nusched = 0x800DA440; +nuContPfs = 0x800DAAD8; +nuSiMesgQ = 0x800DAC78; + gCurrentCameraID = 0x80077410; SCRIPT_NpcDefeat = 0x80077E38; + D_800DC500 = 0x800DC500; D_8010F6D0 = 0x8010F6D0; + gBackgroundImage = 0x80200000; D_802C3000 = 0x802C3000; D_802DBD40 = 0x802DBD40;