diff --git a/asm/non_matchings/main/func_80000BEC.s b/asm/non_matchings/main/func_80000BEC.s deleted file mode 100644 index 93c8b200c..000000000 --- a/asm/non_matchings/main/func_80000BEC.s +++ /dev/null @@ -1,9 +0,0 @@ -glabel func_80000BEC -/* 0017EC 80000BEC 3C0E8030 */ lui $t6, %hi(D_802F9F80) # $t6, 0x8030 -/* 0017F0 80000BF0 3C011FFF */ lui $at, (0x1FFFFFFF >> 16) # lui $at, 0x1fff -/* 0017F4 80000BF4 3421FFFF */ ori $at, (0x1FFFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* 0017F8 80000BF8 25CE9F80 */ addiu $t6, %lo(D_802F9F80) # addiu $t6, $t6, -0x6080 -/* 0017FC 80000BFC 01C17824 */ and $t7, $t6, $at -/* 001800 80000C00 3C018015 */ lui $at, %hi(D_801502B4) # 0x8015 -/* 001804 80000C04 03E00008 */ jr $ra -/* 001808 80000C08 AC2F02B4 */ sw $t7, %lo(D_801502B4)($at) # 0x2b4($at) diff --git a/asm/non_matchings/main/init_controllers.s b/asm/non_matchings/main/init_controllers.s deleted file mode 100644 index 4ccf867e8..000000000 --- a/asm/non_matchings/main/init_controllers.s +++ /dev/null @@ -1,39 +0,0 @@ -glabel init_controllers -/* 0014A4 800008A4 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 0014A8 800008A8 AFBF0014 */ sw $ra, 0x14($sp) -/* 0014AC 800008AC 3C048015 */ lui $a0, %hi(gSIEventMesgQueue) # $a0, 0x8015 -/* 0014B0 800008B0 3C058015 */ lui $a1, %hi(gSIEventMesgBuf) # $a1, 0x8015 -/* 0014B4 800008B4 24A5F0D0 */ addiu $a1, %lo(gSIEventMesgBuf) # addiu $a1, $a1, -0xf30 -/* 0014B8 800008B8 2484F0B8 */ addiu $a0, %lo(gSIEventMesgQueue) # addiu $a0, $a0, -0xf48 -/* 0014BC 800008BC 0C033358 */ jal osCreateMesgQueue -/* 0014C0 800008C0 24060003 */ li $a2, 3 -/* 0014C4 800008C4 3C058015 */ lui $a1, %hi(gSIEventMesgQueue) # $a1, 0x8015 -/* 0014C8 800008C8 3C063333 */ lui $a2, (0x33333333 >> 16) # lui $a2, 0x3333 -/* 0014CC 800008CC 34C63333 */ ori $a2, (0x33333333 & 0xFFFF) # ori $a2, $a2, 0x3333 -/* 0014D0 800008D0 24A5F0B8 */ addiu $a1, %lo(gSIEventMesgQueue) # addiu $a1, $a1, -0xf48 -/* 0014D4 800008D4 0C033380 */ jal osSetEventMesg -/* 0014D8 800008D8 24040005 */ li $a0, 5 -/* 0014DC 800008DC 3C048015 */ lui $a0, %hi(gSIEventMesgQueue) # $a0, 0x8015 -/* 0014E0 800008E0 3C058015 */ lui $a1, %hi(gControllerBits) # $a1, 0x8015 -/* 0014E4 800008E4 3C068015 */ lui $a2, %hi(gControllerStatuses) # $a2, 0x8015 -/* 0014E8 800008E8 24C6F0E0 */ addiu $a2, %lo(gControllerStatuses) # addiu $a2, $a2, -0xf20 -/* 0014EC 800008EC 24A5F108 */ addiu $a1, %lo(gControllerBits) # addiu $a1, $a1, -0xef8 -/* 0014F0 800008F0 0C03344C */ jal osContInit -/* 0014F4 800008F4 2484F0B8 */ addiu $a0, %lo(gSIEventMesgQueue) # addiu $a0, $a0, -0xf48 -/* 0014F8 800008F8 3C0E8015 */ lui $t6, %hi(gControllerBits) # $t6, 0x8015 -/* 0014FC 800008FC 91CEF108 */ lbu $t6, %lo(gControllerBits)($t6) -/* 001500 80000900 24180001 */ li $t8, 1 -/* 001504 80000904 3C018016 */ lui $at, %hi(sController1Unplugged) # 0x8016 -/* 001508 80000908 31CF0001 */ andi $t7, $t6, 1 -/* 00150C 8000090C 15E00004 */ bnez $t7, .L80000920 -/* 001510 80000910 00000000 */ nop -/* 001514 80000914 3C018016 */ lui $at, %hi(sController1Unplugged) # $at, 0x8016 -/* 001518 80000918 10000002 */ b .L80000924 -/* 00151C 8000091C A43825EA */ sh $t8, %lo(sController1Unplugged)($at) -.L80000920: -/* 001520 80000920 A42025EA */ sh $zero, %lo(sController1Unplugged)($at) -.L80000924: -/* 001524 80000924 8FBF0014 */ lw $ra, 0x14($sp) -/* 001528 80000928 27BD0018 */ addiu $sp, $sp, 0x18 -/* 00152C 8000092C 03E00008 */ jr $ra -/* 001530 80000930 00000000 */ nop diff --git a/src/main.c b/src/main.c index 71e322623..adb3cfb07 100644 --- a/src/main.c +++ b/src/main.c @@ -77,6 +77,15 @@ extern OSIoMesg *D_8014F0A0; extern u32 gHeapEndPtr; extern u32 *D_801978D0; +extern OSMesgQueue gSIEventMesgQueue; +extern OSMesg gSIEventMesgBuf[3]; +extern u8 gControllerBits; +extern OSContStatus gControllerStatuses; +extern u16 sController1Unplugged; + +extern u32 D_801502B4; +extern u32 D_802F9F80; + // Declarations (in this file) void thread1_idle(void *arg0); void thread3_video(void *arg0); @@ -180,21 +189,16 @@ void func_800006E8(void) { GLOBAL_ASM("asm/non_matchings/main/func_800006E8.s") #endif -#ifdef MIPS_TO_C -// generated by mips_to_c commit cae1414eb1bf34873a831a523692fe29870a6f3b void init_controllers(void) { - osCreateMesgQueue(&gSIEventMesgQueue, &gSIEventMesgBuf, 3); - osSetEventMesg(5, &gSIEventMesgQueue, (OSMesg) 0x33333333); + osCreateMesgQueue(&gSIEventMesgQueue, &gSIEventMesgBuf, ARRAY_COUNT(gSIEventMesgBuf)); + osSetEventMesg(OS_EVENT_SI, &gSIEventMesgQueue, (OSMesg) 0x33333333); osContInit(&gSIEventMesgQueue, &gControllerBits, &gControllerStatuses); if ((gControllerBits & 1) == 0) { - sController1Unplugged = (u16)1; + sController1Unplugged = TRUE; return; } - *(void *)0x80160000 = (u16)0; + sController1Unplugged = FALSE; } -#else -GLOBAL_ASM("asm/non_matchings/main/init_controllers.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit ffee479fae41a1cdc3e454e9b9d75bbd226a160f @@ -276,14 +280,9 @@ void *read_controllers(void) { GLOBAL_ASM("asm/non_matchings/main/read_controllers.s") #endif -#ifdef MIPS_TO_C -// generated by mips_to_c commit cae1414eb1bf34873a831a523692fe29870a6f3b void func_80000BEC(void) { - *(void *)0x801502B4 = (s32) ((s32) &D_802F9F80 & 0x1FFFFFFF); + D_801502B4 = VIRTUAL_TO_PHYSICAL(&D_802F9F80); } -#else -GLOBAL_ASM("asm/non_matchings/main/func_80000BEC.s") -#endif // send_sp_task_message from SM64 void func_80000C0C(OSMesg arg0) {