mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
About to do something dumb, so I'm commiting this now.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
glabel func_800C8600
|
||||
/* 0C9200 800C8600 3C0E800E */ lui $t6, %hi(D_800E4878) # $t6, 0x800e
|
||||
/* 0C9204 800C8604 8DCE4878 */ lw $t6, %lo(D_800E4878)($t6)
|
||||
/* 0C9200 800C8600 3C0E800E */ lui $t6, %hi(osViClock) # $t6, 0x800e
|
||||
/* 0C9204 800C8604 8DCE4878 */ lw $t6, %lo(osViClock)($t6)
|
||||
/* 0C9208 800C8608 44844000 */ mtc1 $a0, $f8
|
||||
/* 0C920C 800C860C 27BDFFF0 */ addiu $sp, $sp, -0x10
|
||||
/* 0C9210 800C8610 448E2000 */ mtc1 $t6, $f4
|
||||
@@ -78,8 +78,8 @@ glabel func_800C8600
|
||||
/* 0C9318 800C8718 240B0001 */ li $t3, 1
|
||||
/* 0C931C 800C871C 3C0CA450 */ lui $t4, %hi(D_A4500008) # $t4, 0xa450
|
||||
/* 0C9320 800C8720 AD8B0008 */ sw $t3, %lo(D_A4500008)($t4)
|
||||
/* 0C9324 800C8724 3C0D800E */ lui $t5, %hi(D_800E4878) # $t5, 0x800e
|
||||
/* 0C9328 800C8728 8DAD4878 */ lw $t5, %lo(D_800E4878)($t5)
|
||||
/* 0C9324 800C8724 3C0D800E */ lui $t5, %hi(osViClock) # $t5, 0x800e
|
||||
/* 0C9328 800C8728 8DAD4878 */ lw $t5, %lo(osViClock)($t5)
|
||||
/* 0C932C 800C872C 01A5001A */ div $zero, $t5, $a1
|
||||
/* 0C9330 800C8730 00001012 */ mflo $v0
|
||||
/* 0C9334 800C8734 14A00002 */ bnez $a1, .L800C8740
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
glabel __osViInit
|
||||
/* 0D3710 800D2B10 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
/* 0D3714 800D2B14 AFBF0014 */ sw $ra, 0x14($sp)
|
||||
/* 0D3718 800D2B18 3C04800E */ lui $a0, %hi(D_800E4810) # $a0, 0x800e
|
||||
/* 0D371C 800D2B1C 24844810 */ addiu $a0, %lo(D_800E4810) # addiu $a0, $a0, 0x4810
|
||||
/* 0D3718 800D2B18 3C04800E */ lui $a0, %hi(vi) # $a0, 0x800e
|
||||
/* 0D371C 800D2B1C 24844810 */ addiu $a0, %lo(vi) # addiu $a0, $a0, 0x4810
|
||||
/* 0D3720 800D2B20 0C034138 */ jal memzero
|
||||
/* 0D3724 800D2B24 24050060 */ li $a1, 96
|
||||
/* 0D3728 800D2B28 3C0E800E */ lui $t6, %hi(D_800E4810) # $t6, 0x800e
|
||||
/* 0D372C 800D2B2C 25CE4810 */ addiu $t6, %lo(D_800E4810) # addiu $t6, $t6, 0x4810
|
||||
/* 0D3728 800D2B28 3C0E800E */ lui $t6, %hi(vi) # $t6, 0x800e
|
||||
/* 0D372C 800D2B2C 25CE4810 */ addiu $t6, %lo(vi) # addiu $t6, $t6, 0x4810
|
||||
/* 0D3730 800D2B30 3C01800E */ lui $at, %hi(__osViCurr) # $at, 0x800e
|
||||
/* 0D3734 800D2B34 AC2E4870 */ sw $t6, %lo(__osViCurr)($at)
|
||||
/* 0D3738 800D2B38 3C01800E */ lui $at, %hi(__osViNext) # $at, 0x800e
|
||||
@@ -28,10 +28,10 @@ glabel __osViInit
|
||||
/* 0D3778 800D2B78 254A4760 */ addiu $t2, %lo(D_800E4760) # addiu $t2, $t2, 0x4760
|
||||
/* 0D377C 800D2B7C 3C0C02F5 */ lui $t4, (0x02F5B2D2 >> 16) # lui $t4, 0x2f5
|
||||
/* 0D3780 800D2B80 358CB2D2 */ ori $t4, (0x02F5B2D2 & 0xFFFF) # ori $t4, $t4, 0xb2d2
|
||||
/* 0D3784 800D2B84 3C01800E */ lui $at, %hi(D_800E4878) # $at, 0x800e
|
||||
/* 0D3784 800D2B84 3C01800E */ lui $at, %hi(osViClock) # $at, 0x800e
|
||||
/* 0D3788 800D2B88 AD6A0008 */ sw $t2, 8($t3)
|
||||
/* 0D378C 800D2B8C 10000019 */ b .L800D2BF4
|
||||
/* 0D3790 800D2B90 AC2C4878 */ sw $t4, %lo(D_800E4878)($at)
|
||||
/* 0D3790 800D2B90 AC2C4878 */ sw $t4, %lo(osViClock)($at)
|
||||
.L800D2B94:
|
||||
/* 0D3794 800D2B94 3C0D8000 */ lui $t5, %hi(osTvType) # $t5, 0x8000
|
||||
/* 0D3798 800D2B98 8DAD0300 */ lw $t5, %lo(osTvType)($t5)
|
||||
@@ -44,10 +44,10 @@ glabel __osViInit
|
||||
/* 0D37B4 800D2BB4 25EF47B0 */ addiu $t7, %lo(D_800E47B0) # addiu $t7, $t7, 0x47b0
|
||||
/* 0D37B8 800D2BB8 3C0E02E6 */ lui $t6, (0x02E6025C >> 16) # lui $t6, 0x2e6
|
||||
/* 0D37BC 800D2BBC 35CE025C */ ori $t6, (0x02E6025C & 0xFFFF) # ori $t6, $t6, 0x25c
|
||||
/* 0D37C0 800D2BC0 3C01800E */ lui $at, %hi(D_800E4878) # $at, 0x800e
|
||||
/* 0D37C0 800D2BC0 3C01800E */ lui $at, %hi(osViClock) # $at, 0x800e
|
||||
/* 0D37C4 800D2BC4 AF0F0008 */ sw $t7, 8($t8)
|
||||
/* 0D37C8 800D2BC8 1000000A */ b .L800D2BF4
|
||||
/* 0D37CC 800D2BCC AC2E4878 */ sw $t6, %lo(D_800E4878)($at)
|
||||
/* 0D37CC 800D2BCC AC2E4878 */ sw $t6, %lo(osViClock)($at)
|
||||
.L800D2BD0:
|
||||
/* 0D37D0 800D2BD0 3C08800E */ lui $t0, %hi(__osViNext) # $t0, 0x800e
|
||||
/* 0D37D4 800D2BD4 8D084874 */ lw $t0, %lo(__osViNext)($t0)
|
||||
@@ -55,9 +55,9 @@ glabel __osViInit
|
||||
/* 0D37DC 800D2BDC 27394710 */ addiu $t9, %lo(D_800E4710) # addiu $t9, $t9, 0x4710
|
||||
/* 0D37E0 800D2BE0 3C0902E6 */ lui $t1, (0x02E6D354 >> 16) # lui $t1, 0x2e6
|
||||
/* 0D37E4 800D2BE4 3529D354 */ ori $t1, (0x02E6D354 & 0xFFFF) # ori $t1, $t1, 0xd354
|
||||
/* 0D37E8 800D2BE8 3C01800E */ lui $at, %hi(D_800E4878) # $at, 0x800e
|
||||
/* 0D37E8 800D2BE8 3C01800E */ lui $at, %hi(osViClock) # $at, 0x800e
|
||||
/* 0D37EC 800D2BEC AD190008 */ sw $t9, 8($t0)
|
||||
/* 0D37F0 800D2BF0 AC294878 */ sw $t1, %lo(D_800E4878)($at)
|
||||
/* 0D37F0 800D2BF0 AC294878 */ sw $t1, %lo(osViClock)($at)
|
||||
.L800D2BF4:
|
||||
/* 0D37F4 800D2BF4 3C0B800E */ lui $t3, %hi(__osViNext) # $t3, 0x800e
|
||||
/* 0D37F8 800D2BF8 8D6B4874 */ lw $t3, %lo(__osViNext)($t3)
|
||||
|
||||
@@ -25,7 +25,7 @@ typedef struct
|
||||
/* 0x24 */ __OSViScale y;
|
||||
} __OSViContext;
|
||||
|
||||
static __OSViContext vi[2] = {0};
|
||||
__OSViContext vi[2] = {0};
|
||||
|
||||
__OSViContext *__osViCurr = &vi[0];
|
||||
__OSViContext *__osViNext = &vi[1];
|
||||
|
||||
@@ -12,8 +12,8 @@ struct __osThreadTail
|
||||
} __osThreadTail;
|
||||
|
||||
struct __osThreadTail __osThreadTail = {0, -1};
|
||||
OSThread *__osActiveQueue = &__osThreadTail.next;
|
||||
OSThread *__RunQueue = &__osThreadTail.next;
|
||||
OSThread *__osActiveQueue = &__osThreadTail.next;
|
||||
|
||||
extern OSThread *__osRunningThread = NULL;
|
||||
extern OSThread *D_800E4894 = NULL; // __osFaultedThread
|
||||
|
||||
@@ -1,18 +1,57 @@
|
||||
import subprocess
|
||||
import sys
|
||||
import subprocess
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(description="")
|
||||
parser.add_argument("baseLabel", help="Base label")
|
||||
parser.add_argument("badLabel", help="Bad label")
|
||||
args = parser.parse_args()
|
||||
def fixBadLabel():
|
||||
parser = argparse.ArgumentParser(description="")
|
||||
parser.add_argument("baseLabel", help="Base label")
|
||||
parser.add_argument("badLabel", help="Bad label")
|
||||
args = parser.parse_args()
|
||||
|
||||
baseAddress = int(args.baseLabel[-8:], 16)
|
||||
badAddress = int(args.badLabel[-8:], 16)
|
||||
baseAddress = int(args.baseLabel[-8:], 16)
|
||||
badAddress = int(args.badLabel[-8:], 16)
|
||||
|
||||
if baseAddress >= badAddress:
|
||||
raise Exception('baseLabel should be smaller! base = ' + hex(baseAddress) + ', bad = ' + hex(badAddress))
|
||||
if baseAddress >= badAddress:
|
||||
raise Exception('baseLabel should be smaller! base = ' + hex(baseAddress) + ', bad = ' + hex(badAddress))
|
||||
|
||||
newLabel = args.baseLabel + '+' + str(badAddress-baseAddress)
|
||||
newLabel = args.baseLabel + '+' + str(badAddress-baseAddress)
|
||||
|
||||
subprocess.run(['./rename_sym.sh', args.badLabel, newLabel])
|
||||
|
||||
def load_syms():
|
||||
with open('undefined_syms.txt', 'r') as inFile:
|
||||
return inFile.read().split('\n')
|
||||
|
||||
def save_syms(syms):
|
||||
with open('undefined_syms.txt', 'w') as outFile:
|
||||
outFile.write('\n'.join(syms))
|
||||
|
||||
def check_is_double(symbol, address):
|
||||
command = subprocess.run(['fgrep', '-ri', symbol], capture_output=True)
|
||||
outLines = command.stdout.decode("utf-8").split('\n')
|
||||
for outLine in outLines:
|
||||
if 'lwc1' in outLine:
|
||||
newSym = hex(address - 4)[2:].upper() + '+4'
|
||||
subprocess.run(['./rename_sym.sh', symbol, newSym])
|
||||
return True
|
||||
return False
|
||||
|
||||
def fixDoubleLoads():
|
||||
syms = load_syms()
|
||||
for i in range(0, len(syms)):
|
||||
sym = syms[i]
|
||||
if not sym.startswith('D_'):
|
||||
continue
|
||||
symSplit = sym.split(' = ')
|
||||
symbol = symSplit[0]
|
||||
address = int(symSplit[1][2:-1], 16)
|
||||
if address >= 0x800E4BFC and address < 0x800E9BA0 and (address & 4 == 4):
|
||||
if check_is_double(symbol, address):
|
||||
syms.pop(i)
|
||||
i -= 1
|
||||
save_syms(syms)
|
||||
|
||||
#fixBadLabel()
|
||||
fixDoubleLoads()
|
||||
|
||||
subprocess.run(['./rename_sym.sh', args.badLabel, newLabel])
|
||||
|
||||
@@ -25,10 +25,6 @@ osAppNMIBuffer = 0x8000031C;
|
||||
D_800E0001 = 0x800E0001;
|
||||
eqpower = 0x800E37A0;
|
||||
|
||||
D_800E4810 = 0x800E4810;
|
||||
D_800E4878 = 0x800E4878;
|
||||
__RunQueue = 0x800E4888;
|
||||
__osActiveQueue = 0x800E488C;
|
||||
D_800E4BFC = 0x800E4BFC;
|
||||
D_800E4C0C = 0x800E4C0C;
|
||||
D_800E4C14 = 0x800E4C14;
|
||||
|
||||
Reference in New Issue
Block a user