near-match boot_main

This commit is contained in:
Alex Bates 2020-10-15 01:49:59 +01:00
parent d52f53e9c6
commit c1df5a8612
No known key found for this signature in database
GPG Key ID: 5E11C2DB78877706
3 changed files with 132 additions and 87 deletions

View File

@ -66,72 +66,3 @@ glabel boot_main
.L80026054: .L80026054:
/* 1454 80026054 08009815 */ j .L80026054 /* 1454 80026054 08009815 */ j .L80026054
/* 1458 80026058 00000000 */ nop /* 1458 80026058 00000000 */ nop
/* 145C 8002605C 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 1460 80026060 AFB10014 */ sw $s1, 0x14($sp)
/* 1464 80026064 3C118007 */ lui $s1, 0x8007
/* 1468 80026068 26313E00 */ addiu $s1, $s1, 0x3e00
/* 146C 8002606C AFBF0018 */ sw $ra, 0x18($sp)
/* 1470 80026070 AFB00010 */ sw $s0, 0x10($sp)
/* 1474 80026074 8E230000 */ lw $v1, ($s1)
/* 1478 80026078 10600022 */ beqz $v1, .L80026104
/* 147C 8002607C 0080802D */ daddu $s0, $a0, $zero
/* 1480 80026080 24020001 */ addiu $v0, $zero, 1
/* 1484 80026084 14620016 */ bne $v1, $v0, .L800260E0
/* 1488 80026088 00000000 */ nop
/* 148C 8002608C 0C017CB4 */ jal nuGfxTaskAllEndWait
/* 1490 80026090 00000000 */ nop
/* 1494 80026094 16000012 */ bnez $s0, .L800260E0
/* 1498 80026098 00000000 */ nop
/* 149C 8002609C 0C019A6C */ jal osViGetCurrentFramebuffer
/* 14A0 800260A0 00000000 */ nop
/* 14A4 800260A4 3C10800A */ lui $s0, 0x800a
/* 14A8 800260A8 2610A680 */ addiu $s0, $s0, -0x5980
/* 14AC 800260AC 0200202D */ daddu $a0, $s0, $zero
/* 14B0 800260B0 AE020008 */ sw $v0, 8($s0)
/* 14B4 800260B4 AE020004 */ sw $v0, 4($s0)
/* 14B8 800260B8 AE020000 */ sw $v0, ($s0)
/* 14BC 800260BC 3C018007 */ lui $at, 0x8007
/* 14C0 800260C0 AC223E04 */ sw $v0, 0x3e04($at)
/* 14C4 800260C4 0C017CBC */ jal nuGfxSetCfb
/* 14C8 800260C8 24050003 */ addiu $a1, $zero, 3
/* 14CC 800260CC 8E040000 */ lw $a0, ($s0)
/* 14D0 800260D0 0C019C08 */ jal osViSwapBuffer
/* 14D4 800260D4 00000000 */ nop
/* 14D8 800260D8 24020002 */ addiu $v0, $zero, 2
/* 14DC 800260DC AE220000 */ sw $v0, ($s1)
.L800260E0:
/* 14E0 800260E0 3C038007 */ lui $v1, 0x8007
/* 14E4 800260E4 8C633E00 */ lw $v1, 0x3e00($v1)
/* 14E8 800260E8 24020002 */ addiu $v0, $zero, 2
/* 14EC 800260EC 14620018 */ bne $v1, $v0, .L80026150
/* 14F0 800260F0 00000000 */ nop
/* 14F4 800260F4 0C009859 */ jal func_80026164
/* 14F8 800260F8 00000000 */ nop
/* 14FC 800260FC 08009854 */ j .L80026150
/* 1500 80026100 00000000 */ nop
.L80026104:
/* 1504 80026104 3C038007 */ lui $v1, 0x8007
/* 1508 80026108 24633E0A */ addiu $v1, $v1, 0x3e0a
/* 150C 8002610C 94620000 */ lhu $v0, ($v1)
/* 1510 80026110 38420001 */ xori $v0, $v0, 1
/* 1514 80026114 1440000E */ bnez $v0, .L80026150
/* 1518 80026118 A4620000 */ sh $v0, ($v1)
/* 151C 8002611C 0C0099D0 */ jal step_game_loop
/* 1520 80026120 00000000 */ nop
/* 1524 80026124 3C038007 */ lui $v1, 0x8007
/* 1528 80026128 24633E08 */ addiu $v1, $v1, 0x3e08
/* 152C 8002612C 24020001 */ addiu $v0, $zero, 1
/* 1530 80026130 A4620000 */ sh $v0, ($v1)
/* 1534 80026134 2A020003 */ slti $v0, $s0, 3
/* 1538 80026138 10400005 */ beqz $v0, .L80026150
/* 153C 8002613C 00000000 */ nop
/* 1540 80026140 0C009A7B */ jal func_800269EC
/* 1544 80026144 A4600000 */ sh $zero, ($v1)
/* 1548 80026148 0C009AC2 */ jal gfx_draw_frame
/* 154C 8002614C 00000000 */ nop
.L80026150:
/* 1550 80026150 8FBF0018 */ lw $ra, 0x18($sp)
/* 1554 80026154 8FB10014 */ lw $s1, 0x14($sp)
/* 1558 80026158 8FB00010 */ lw $s0, 0x10($sp)
/* 155C 8002615C 03E00008 */ jr $ra
/* 1560 80026160 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -0,0 +1,73 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel gfxRetrace_Callback
/* 145C 8002605C 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 1460 80026060 AFB10014 */ sw $s1, 0x14($sp)
/* 1464 80026064 3C118007 */ lui $s1, 0x8007
/* 1468 80026068 26313E00 */ addiu $s1, $s1, 0x3e00
/* 146C 8002606C AFBF0018 */ sw $ra, 0x18($sp)
/* 1470 80026070 AFB00010 */ sw $s0, 0x10($sp)
/* 1474 80026074 8E230000 */ lw $v1, ($s1)
/* 1478 80026078 10600022 */ beqz $v1, .L80026104
/* 147C 8002607C 0080802D */ daddu $s0, $a0, $zero
/* 1480 80026080 24020001 */ addiu $v0, $zero, 1
/* 1484 80026084 14620016 */ bne $v1, $v0, .L800260E0
/* 1488 80026088 00000000 */ nop
/* 148C 8002608C 0C017CB4 */ jal nuGfxTaskAllEndWait
/* 1490 80026090 00000000 */ nop
/* 1494 80026094 16000012 */ bnez $s0, .L800260E0
/* 1498 80026098 00000000 */ nop
/* 149C 8002609C 0C019A6C */ jal osViGetCurrentFramebuffer
/* 14A0 800260A0 00000000 */ nop
/* 14A4 800260A4 3C10800A */ lui $s0, 0x800a
/* 14A8 800260A8 2610A680 */ addiu $s0, $s0, -0x5980
/* 14AC 800260AC 0200202D */ daddu $a0, $s0, $zero
/* 14B0 800260B0 AE020008 */ sw $v0, 8($s0)
/* 14B4 800260B4 AE020004 */ sw $v0, 4($s0)
/* 14B8 800260B8 AE020000 */ sw $v0, ($s0)
/* 14BC 800260BC 3C018007 */ lui $at, 0x8007
/* 14C0 800260C0 AC223E04 */ sw $v0, 0x3e04($at)
/* 14C4 800260C4 0C017CBC */ jal nuGfxSetCfb
/* 14C8 800260C8 24050003 */ addiu $a1, $zero, 3
/* 14CC 800260CC 8E040000 */ lw $a0, ($s0)
/* 14D0 800260D0 0C019C08 */ jal osViSwapBuffer
/* 14D4 800260D4 00000000 */ nop
/* 14D8 800260D8 24020002 */ addiu $v0, $zero, 2
/* 14DC 800260DC AE220000 */ sw $v0, ($s1)
.L800260E0:
/* 14E0 800260E0 3C038007 */ lui $v1, 0x8007
/* 14E4 800260E4 8C633E00 */ lw $v1, 0x3e00($v1)
/* 14E8 800260E8 24020002 */ addiu $v0, $zero, 2
/* 14EC 800260EC 14620018 */ bne $v1, $v0, .L80026150
/* 14F0 800260F0 00000000 */ nop
/* 14F4 800260F4 0C009859 */ jal func_80026164
/* 14F8 800260F8 00000000 */ nop
/* 14FC 800260FC 08009854 */ j .L80026150
/* 1500 80026100 00000000 */ nop
.L80026104:
/* 1504 80026104 3C038007 */ lui $v1, 0x8007
/* 1508 80026108 24633E0A */ addiu $v1, $v1, 0x3e0a
/* 150C 8002610C 94620000 */ lhu $v0, ($v1)
/* 1510 80026110 38420001 */ xori $v0, $v0, 1
/* 1514 80026114 1440000E */ bnez $v0, .L80026150
/* 1518 80026118 A4620000 */ sh $v0, ($v1)
/* 151C 8002611C 0C0099D0 */ jal step_game_loop
/* 1520 80026120 00000000 */ nop
/* 1524 80026124 3C038007 */ lui $v1, 0x8007
/* 1528 80026128 24633E08 */ addiu $v1, $v1, 0x3e08
/* 152C 8002612C 24020001 */ addiu $v0, $zero, 1
/* 1530 80026130 A4620000 */ sh $v0, ($v1)
/* 1534 80026134 2A020003 */ slti $v0, $s0, 3
/* 1538 80026138 10400005 */ beqz $v0, .L80026150
/* 153C 8002613C 00000000 */ nop
/* 1540 80026140 0C009A7B */ jal func_800269EC
/* 1544 80026144 A4600000 */ sh $zero, ($v1)
/* 1548 80026148 0C009AC2 */ jal gfx_draw_frame
/* 154C 8002614C 00000000 */ nop
.L80026150:
/* 1550 80026150 8FBF0018 */ lw $ra, 0x18($sp)
/* 1554 80026154 8FB10014 */ lw $s1, 0x14($sp)
/* 1558 80026158 8FB00010 */ lw $s0, 0x10($sp)
/* 155C 8002615C 03E00008 */ jr $ra
/* 1560 80026160 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,7 +1,48 @@
#include "common.h" #include "common.h"
#include "nu/nusys.h"
INCLUDE_ASM(s32, "code_1370_len_7d0", boot_main); void gfxRetrace_Callback(void);
void gfxPreNMI_Callback(void);
#ifdef NON_MATCHING
// Control flow issue w/ PANIC
void boot_main(void) {
OSViMode* viMode;
if (osTvType == OS_TV_NTSC) {
viMode = &osViModeTable[56];
} else if (osTvType == OS_TV_MPAL) {
viMode = &osViModeTable[57];
} else {
PANIC();
}
osViSetMode(viMode);
osViSetSpecialFeatures(OS_VI_GAMMA_OFF | OS_VI_GAMMA_DITHER_OFF | OS_VI_DIVOT_ON | OS_VI_DITHER_FILTER_ON);
nuGfxDisplayOff();
crash_create_monitor();
func_80025C60();
nuGfxInit();
GAME_STATUS->contBitPattern = nuContInit();
func_8002D160();
func_802B2000();
func_802B203C();
nuGfxFuncSet(gfxRetrace_Callback);
nuGfxPreNMIFuncSet(gfxPreNMI_Callback);
{
// Required to match
s32* randSeed = &gRandSeed;
(*randSeed) += osGetCount();
}
nuGfxDisplayOn();
while (TRUE) {}
}
#else
INCLUDE_ASM(void, "code_1370_len_7d0", boot_main, void);
#endif
INCLUDE_ASM(void, "code_1370_len_7d0", gfxRetrace_Callback, void);
INCLUDE_ASM(s32, "code_1370_len_7d0", func_80026164); INCLUDE_ASM(s32, "code_1370_len_7d0", func_80026164);
INCLUDE_ASM(s32, "code_1370_len_7d0", gfxPreNMI_Callback); INCLUDE_ASM(void, "code_1370_len_7d0", gfxPreNMI_Callback, void);