mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Started decompilation!
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
# Baseroms is where the user will place their ROM files.
|
||||
baseroms/*
|
||||
|
||||
# Ignore pycache
|
||||
__pycache__
|
||||
|
||||
# Automatically generated folders should be ignored
|
||||
build/
|
||||
assets/
|
||||
|
||||
@@ -10,7 +10,7 @@ SHELL := /bin/bash
|
||||
BUILD_DIR = build
|
||||
|
||||
##################### Compiler Options #######################
|
||||
#IRIX_ROOT := tools/ido5.3_compiler
|
||||
IRIX_ROOT := tools/ido5.3_compiler
|
||||
|
||||
ifeq ($(shell type mips-linux-gnu-ld >/dev/null 2>/dev/null; echo $$?), 0)
|
||||
CROSS := mips-linux-gnu-
|
||||
@@ -21,24 +21,22 @@ else
|
||||
endif
|
||||
|
||||
# check that either QEMU_IRIX is set or qemu-irix package installed
|
||||
#ifndef QEMU_IRIX
|
||||
# QEMU_IRIX := $(shell which qemu-irix 2>/dev/null)
|
||||
# ifeq (, $(QEMU_IRIX))
|
||||
# $(error Please install qemu-irix package or set QEMU_IRIX env var to the full qemu-irix binary path)
|
||||
# endif
|
||||
#endif
|
||||
ifndef QEMU_IRIX
|
||||
QEMU_IRIX := $(shell which qemu-irix 2>/dev/null)
|
||||
ifeq (, $(QEMU_IRIX))
|
||||
$(error Please install qemu-irix package or set QEMU_IRIX env var to the full qemu-irix binary path)
|
||||
endif
|
||||
endif
|
||||
|
||||
AS = $(CROSS)as
|
||||
#CC = $(CROSS)gcc
|
||||
CC := $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc
|
||||
CPP := cpp -P -Wno-trigraphs
|
||||
LD = $(CROSS)ld
|
||||
OBJDUMP = $(CROSS)objdump
|
||||
OBJCOPY = $(CROSS)objcopy --pad-to=0xC00000 --gap-fill=0xFF
|
||||
|
||||
INCLUDE_FLAGS := -I$(BUILD_DIR)
|
||||
ASFLAGS = -mtune=vr4300 -march=vr4300 $(INCLUDE_FLAGS)
|
||||
CFLAGS = -Wall -O2 -mtune=vr4300 -march=vr4300 -G 0 -c
|
||||
CFLAGS = -c -Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm -Xfullwarn -signed -O2 -mips1
|
||||
LDFLAGS = undefined_syms.txt -T $(LD_SCRIPT) -Map $(BUILD_DIR)/dkr.map
|
||||
|
||||
####################### Other Tools #########################
|
||||
@@ -61,12 +59,15 @@ ASM_DIRS := asm asm/boot asm/assets
|
||||
SRC_DIRS := src
|
||||
ASSETS_DIRS := animations audio billboards bin cheats fonts levels objects particles text textures textures/2d textures/3d tt_ghosts ucode
|
||||
|
||||
S_FILES := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/*.s))
|
||||
GLOBAL_ASM_C_FILES != grep -rl 'GLOBAL_ASM(' $(wildcard src/*/*.c)
|
||||
GLOBAL_ASM_O_FILES = $(foreach file,$(GLOBAL_ASM_C_FILES),$(BUILD_DIR)/$(file:.c=.o))
|
||||
|
||||
BUILD_ASM_DIRS := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/**/))
|
||||
S_FILES := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/*.s))
|
||||
C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c))
|
||||
|
||||
# Object files
|
||||
O_FILES := $(foreach file,$(S_FILES),$(BUILD_DIR)/$(file:.s=.o))
|
||||
O_FILES := $(foreach file,$(S_FILES),$(BUILD_DIR)/$(file:.s=.o)) \
|
||||
$(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.o))
|
||||
|
||||
|
||||
####################### ASSETS #########################
|
||||
@@ -167,7 +168,7 @@ clean:
|
||||
rm -r $(BUILD_DIR)
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(ASM_DIRS) $(ASSETS_DIRS))
|
||||
mkdir $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(ASM_DIRS) $(SRC_DIRS) $(ASSETS_DIRS))
|
||||
|
||||
# This is here to prevent make from deleting all the asset files after the build completes/fails.
|
||||
dont_remove_asset_files: $(ALL_ASSETS_BUILT)
|
||||
@@ -233,6 +234,9 @@ $(UCODE_OUT_DIR)/%.bin: $(UCODE_IN_DIR)/%.bin
|
||||
$(BUILD_DIR)/%.o: %.s Makefile $(MAKEFILE_SPLIT) | $(BUILD_DIR) $(ALL_ASSETS_BUILT)
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT)
|
||||
$(CPP) $(VERSION_CFLAGS) -DBUILD_DIR=$(BUILD_DIR) -MMD -MP -MT $@ -MF $@.d -o $@ $<
|
||||
|
||||
@@ -253,6 +257,8 @@ $(BUILD_DIR)/$(TARGET).hex: $(BUILD_DIR)/$(TARGET).z64
|
||||
|
||||
$(BUILD_DIR)/$(TARGET).objdump: $(BUILD_DIR)/$(TARGET).elf
|
||||
$(OBJDUMP) -D $< > $@
|
||||
|
||||
$(GLOBAL_ASM_O_FILES): CC := $(PYTHON) tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
|
||||
test: $(BUILD_DIR)/$(TARGET).z64
|
||||
$(EMULATOR) $(EMU_FLAGS) $<
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
glabel func_80065C38
|
||||
/* 066838 80065C38 27BDFFE0 */ addiu $sp, $sp, -0x20
|
||||
/* 06683C 80065C3C AFBF0014 */ sw $ra, 0x14($sp)
|
||||
/* 066840 80065C40 AFA40020 */ sw $a0, 0x20($sp)
|
||||
/* 066844 80065C44 AFA50024 */ sw $a1, 0x24($sp)
|
||||
/* 066848 80065C48 AFA60028 */ sw $a2, 0x28($sp)
|
||||
/* 06684C 80065C4C AFA7002C */ sw $a3, 0x2c($sp)
|
||||
/* 066850 80065C50 8CAF0008 */ lw $t7, 8($a1)
|
||||
/* 066854 80065C54 00000000 */ nop
|
||||
/* 066858 80065C58 11E00036 */ beqz $t7, .L80065D34
|
||||
/* 06685C 80065C5C 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
/* 066860 80065C60 0C01959A */ jal func_80065668
|
||||
/* 066864 80065C64 00000000 */ nop
|
||||
/* 066868 80065C68 10400031 */ beqz $v0, .L80065D30
|
||||
/* 06686C 80065C6C 00403025 */ move $a2, $v0
|
||||
/* 066870 80065C70 8FA20024 */ lw $v0, 0x24($sp)
|
||||
/* 066874 80065C74 8FB80020 */ lw $t8, 0x20($sp)
|
||||
/* 066878 80065C78 8C480008 */ lw $t0, 8($v0)
|
||||
/* 06687C 80065C7C 8F19001C */ lw $t9, 0x1c($t8)
|
||||
/* 066880 80065C80 8D0900D8 */ lw $t1, 0xd8($t0)
|
||||
/* 066884 80065C84 240B000D */ li $t3, 13
|
||||
/* 066888 80065C88 03295021 */ addu $t2, $t9, $t1
|
||||
/* 06688C 80065C8C ACCA0004 */ sw $t2, 4($a2)
|
||||
/* 066890 80065C90 ACC00000 */ sw $zero, ($a2)
|
||||
/* 066894 80065C94 A4CB0008 */ sh $t3, 8($a2)
|
||||
/* 066898 80065C98 844C001A */ lh $t4, 0x1a($v0)
|
||||
/* 06689C 80065C9C 00000000 */ nop
|
||||
/* 0668A0 80065CA0 A4CC000A */ sh $t4, 0xa($a2)
|
||||
/* 0668A4 80065CA4 93A40037 */ lbu $a0, 0x37($sp)
|
||||
/* 0668A8 80065CA8 0C0196FB */ jal func_80065BEC
|
||||
/* 0668AC 80065CAC AFA6001C */ sw $a2, 0x1c($sp)
|
||||
/* 0668B0 80065CB0 8FA6001C */ lw $a2, 0x1c($sp)
|
||||
/* 0668B4 80065CB4 00000000 */ nop
|
||||
/* 0668B8 80065CB8 A0C20012 */ sb $v0, 0x12($a2)
|
||||
/* 0668BC 80065CBC 87AD0032 */ lh $t5, 0x32($sp)
|
||||
/* 0668C0 80065CC0 00000000 */ nop
|
||||
/* 0668C4 80065CC4 A4CD0010 */ sh $t5, 0x10($a2)
|
||||
/* 0668C8 80065CC8 93AE003B */ lbu $t6, 0x3b($sp)
|
||||
/* 0668CC 80065CCC 00000000 */ nop
|
||||
/* 0668D0 80065CD0 A0CE0013 */ sb $t6, 0x13($a2)
|
||||
/* 0668D4 80065CD4 C7A4002C */ lwc1 $f4, 0x2c($sp)
|
||||
/* 0668D8 80065CD8 00000000 */ nop
|
||||
/* 0668DC 80065CDC E4C4000C */ swc1 $f4, 0xc($a2)
|
||||
/* 0668E0 80065CE0 8FA5003C */ lw $a1, 0x3c($sp)
|
||||
/* 0668E4 80065CE4 8FA40020 */ lw $a0, 0x20($sp)
|
||||
/* 0668E8 80065CE8 0C0195F1 */ jal func_800657C4
|
||||
/* 0668EC 80065CEC 00000000 */ nop
|
||||
/* 0668F0 80065CF0 8FA6001C */ lw $a2, 0x1c($sp)
|
||||
/* 0668F4 80065CF4 24050003 */ li $a1, 3
|
||||
/* 0668F8 80065CF8 ACC20014 */ sw $v0, 0x14($a2)
|
||||
/* 0668FC 80065CFC 8FAF0028 */ lw $t7, 0x28($sp)
|
||||
/* 066900 80065D00 00000000 */ nop
|
||||
/* 066904 80065D04 ACCF0018 */ sw $t7, 0x18($a2)
|
||||
/* 066908 80065D08 8FB80024 */ lw $t8, 0x24($sp)
|
||||
/* 06690C 80065D0C 00000000 */ nop
|
||||
/* 066910 80065D10 8F080008 */ lw $t0, 8($t8)
|
||||
/* 066914 80065D14 00000000 */ nop
|
||||
/* 066918 80065D18 8D04000C */ lw $a0, 0xc($t0)
|
||||
/* 06691C 80065D1C 00000000 */ nop
|
||||
/* 066920 80065D20 8C990008 */ lw $t9, 8($a0)
|
||||
/* 066924 80065D24 00000000 */ nop
|
||||
/* 066928 80065D28 0320F809 */ jalr $t9
|
||||
/* 06692C 80065D2C 00000000 */ nop
|
||||
.L80065D30:
|
||||
/* 066930 80065D30 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
.L80065D34:
|
||||
/* 066934 80065D34 27BD0020 */ addiu $sp, $sp, 0x20
|
||||
/* 066938 80065D38 03E00008 */ jr $ra
|
||||
/* 06693C 80065D3C 00000000 */ nop
|
||||
@@ -17,6 +17,5 @@ glabel func_80063C00
|
||||
/* 06481C 80063C1C 93220010 */ lbu $v0, 0x10($t9)
|
||||
/* 064820 80063C20 03E00008 */ jr $ra
|
||||
/* 064824 80063C24 00000000 */ nop
|
||||
|
||||
/* 064828 80063C28 00000000 */ nop
|
||||
/* 06482C 80063C2C 00000000 */ nop
|
||||
|
||||
+102
-104
@@ -6,112 +6,110 @@
|
||||
.set noreorder # dont insert nops after branches
|
||||
.set gp=64 # 64-bit instructions are used
|
||||
|
||||
glabel func_80065BD0
|
||||
/* 0667D0 80065BD0 3C01800E */ lui $at, 0x800e
|
||||
/* 0667D4 80065BD4 03E00008 */ jr $ra
|
||||
/* 0667D8 80065BD8 A424D050 */ sh $a0, -0x2fb0($at)
|
||||
#glabel func_80065BD0
|
||||
#/* 0667D0 80065BD0 3C01800E */ lui $at, 0x800e
|
||||
#/* 0667D4 80065BD4 03E00008 */ jr $ra
|
||||
#/* 0667D8 80065BD8 A424D050 */ sh $a0, -0x2fb0($at)
|
||||
#
|
||||
#/* 0667DC 80065BDC 3C02800E */ lui $v0, %hi(D_800DD050) # $v0, 0x800e
|
||||
#/* 0667E0 80065BE0 8442D050 */ lh $v0, %lo(D_800DD050)($v0)
|
||||
#/* 0667E4 80065BE4 03E00008 */ jr $ra
|
||||
#/* 0667E8 80065BE8 00000000 */ nop
|
||||
|
||||
/* 0667DC 80065BDC 3C02800E */ lui $v0, %hi(D_800DD050) # $v0, 0x800e
|
||||
/* 0667E0 80065BE0 8442D050 */ lh $v0, %lo(D_800DD050)($v0)
|
||||
/* 0667E4 80065BE4 03E00008 */ jr $ra
|
||||
/* 0667E8 80065BE8 00000000 */ nop
|
||||
#glabel func_80065BEC
|
||||
#/* 0667EC 80065BEC 3C02800E */ lui $v0, %hi(D_800DD050) # $v0, 0x800e
|
||||
#/* 0667F0 80065BF0 8442D050 */ lh $v0, %lo(D_800DD050)($v0)
|
||||
#/* 0667F4 80065BF4 24010001 */ li $at, 1
|
||||
#/* 0667F8 80065BF8 10400007 */ beqz $v0, .L80065C18
|
||||
#/* 0667FC 80065BFC 00000000 */ nop
|
||||
#/* 066800 80065C00 1041000A */ beq $v0, $at, .L80065C2C
|
||||
#/* 066804 80065C04 24010002 */ li $at, 2
|
||||
#/* 066808 80065C08 10410005 */ beq $v0, $at, .L80065C20
|
||||
#/* 06680C 80065C0C 2484FFC0 */ addiu $a0, $a0, -0x40
|
||||
#/* 066810 80065C10 10000007 */ b .L80065C30
|
||||
#/* 066814 80065C14 24020040 */ li $v0, 64
|
||||
#.L80065C18:
|
||||
#/* 066818 80065C18 03E00008 */ jr $ra
|
||||
#/* 06681C 80065C1C 00801025 */ move $v0, $a0
|
||||
#.L80065C20:
|
||||
#/* 066820 80065C20 00047043 */ sra $t6, $a0, 1
|
||||
#/* 066824 80065C24 03E00008 */ jr $ra
|
||||
#/* 066828 80065C28 25C20040 */ addiu $v0, $t6, 0x40
|
||||
#.L80065C2C:
|
||||
#/* 06682C 80065C2C 24020040 */ li $v0, 64
|
||||
#.L80065C30:
|
||||
#/* 066830 80065C30 03E00008 */ jr $ra
|
||||
#/* 066834 80065C34 00000000 */ nop
|
||||
|
||||
glabel func_80065BEC
|
||||
/* 0667EC 80065BEC 3C02800E */ lui $v0, %hi(D_800DD050) # $v0, 0x800e
|
||||
/* 0667F0 80065BF0 8442D050 */ lh $v0, %lo(D_800DD050)($v0)
|
||||
/* 0667F4 80065BF4 24010001 */ li $at, 1
|
||||
/* 0667F8 80065BF8 10400007 */ beqz $v0, .L80065C18
|
||||
/* 0667FC 80065BFC 00000000 */ nop
|
||||
/* 066800 80065C00 1041000A */ beq $v0, $at, .L80065C2C
|
||||
/* 066804 80065C04 24010002 */ li $at, 2
|
||||
/* 066808 80065C08 10410005 */ beq $v0, $at, .L80065C20
|
||||
/* 06680C 80065C0C 2484FFC0 */ addiu $a0, $a0, -0x40
|
||||
/* 066810 80065C10 10000007 */ b .L80065C30
|
||||
/* 066814 80065C14 24020040 */ li $v0, 64
|
||||
.L80065C18:
|
||||
/* 066818 80065C18 03E00008 */ jr $ra
|
||||
/* 06681C 80065C1C 00801025 */ move $v0, $a0
|
||||
|
||||
.L80065C20:
|
||||
/* 066820 80065C20 00047043 */ sra $t6, $a0, 1
|
||||
/* 066824 80065C24 03E00008 */ jr $ra
|
||||
/* 066828 80065C28 25C20040 */ addiu $v0, $t6, 0x40
|
||||
|
||||
.L80065C2C:
|
||||
/* 06682C 80065C2C 24020040 */ li $v0, 64
|
||||
.L80065C30:
|
||||
/* 066830 80065C30 03E00008 */ jr $ra
|
||||
/* 066834 80065C34 00000000 */ nop
|
||||
|
||||
glabel func_80065C38
|
||||
/* 066838 80065C38 27BDFFE0 */ addiu $sp, $sp, -0x20
|
||||
/* 06683C 80065C3C AFBF0014 */ sw $ra, 0x14($sp)
|
||||
/* 066840 80065C40 AFA40020 */ sw $a0, 0x20($sp)
|
||||
/* 066844 80065C44 AFA50024 */ sw $a1, 0x24($sp)
|
||||
/* 066848 80065C48 AFA60028 */ sw $a2, 0x28($sp)
|
||||
/* 06684C 80065C4C AFA7002C */ sw $a3, 0x2c($sp)
|
||||
/* 066850 80065C50 8CAF0008 */ lw $t7, 8($a1)
|
||||
/* 066854 80065C54 00000000 */ nop
|
||||
/* 066858 80065C58 11E00036 */ beqz $t7, .L80065D34
|
||||
/* 06685C 80065C5C 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
/* 066860 80065C60 0C01959A */ jal func_80065668
|
||||
/* 066864 80065C64 00000000 */ nop
|
||||
/* 066868 80065C68 10400031 */ beqz $v0, .L80065D30
|
||||
/* 06686C 80065C6C 00403025 */ move $a2, $v0
|
||||
/* 066870 80065C70 8FA20024 */ lw $v0, 0x24($sp)
|
||||
/* 066874 80065C74 8FB80020 */ lw $t8, 0x20($sp)
|
||||
/* 066878 80065C78 8C480008 */ lw $t0, 8($v0)
|
||||
/* 06687C 80065C7C 8F19001C */ lw $t9, 0x1c($t8)
|
||||
/* 066880 80065C80 8D0900D8 */ lw $t1, 0xd8($t0)
|
||||
/* 066884 80065C84 240B000D */ li $t3, 13
|
||||
/* 066888 80065C88 03295021 */ addu $t2, $t9, $t1
|
||||
/* 06688C 80065C8C ACCA0004 */ sw $t2, 4($a2)
|
||||
/* 066890 80065C90 ACC00000 */ sw $zero, ($a2)
|
||||
/* 066894 80065C94 A4CB0008 */ sh $t3, 8($a2)
|
||||
/* 066898 80065C98 844C001A */ lh $t4, 0x1a($v0)
|
||||
/* 06689C 80065C9C 00000000 */ nop
|
||||
/* 0668A0 80065CA0 A4CC000A */ sh $t4, 0xa($a2)
|
||||
/* 0668A4 80065CA4 93A40037 */ lbu $a0, 0x37($sp)
|
||||
/* 0668A8 80065CA8 0C0196FB */ jal func_80065BEC
|
||||
/* 0668AC 80065CAC AFA6001C */ sw $a2, 0x1c($sp)
|
||||
/* 0668B0 80065CB0 8FA6001C */ lw $a2, 0x1c($sp)
|
||||
/* 0668B4 80065CB4 00000000 */ nop
|
||||
/* 0668B8 80065CB8 A0C20012 */ sb $v0, 0x12($a2)
|
||||
/* 0668BC 80065CBC 87AD0032 */ lh $t5, 0x32($sp)
|
||||
/* 0668C0 80065CC0 00000000 */ nop
|
||||
/* 0668C4 80065CC4 A4CD0010 */ sh $t5, 0x10($a2)
|
||||
/* 0668C8 80065CC8 93AE003B */ lbu $t6, 0x3b($sp)
|
||||
/* 0668CC 80065CCC 00000000 */ nop
|
||||
/* 0668D0 80065CD0 A0CE0013 */ sb $t6, 0x13($a2)
|
||||
/* 0668D4 80065CD4 C7A4002C */ lwc1 $f4, 0x2c($sp)
|
||||
/* 0668D8 80065CD8 00000000 */ nop
|
||||
/* 0668DC 80065CDC E4C4000C */ swc1 $f4, 0xc($a2)
|
||||
/* 0668E0 80065CE0 8FA5003C */ lw $a1, 0x3c($sp)
|
||||
/* 0668E4 80065CE4 8FA40020 */ lw $a0, 0x20($sp)
|
||||
/* 0668E8 80065CE8 0C0195F1 */ jal func_800657C4
|
||||
/* 0668EC 80065CEC 00000000 */ nop
|
||||
/* 0668F0 80065CF0 8FA6001C */ lw $a2, 0x1c($sp)
|
||||
/* 0668F4 80065CF4 24050003 */ li $a1, 3
|
||||
/* 0668F8 80065CF8 ACC20014 */ sw $v0, 0x14($a2)
|
||||
/* 0668FC 80065CFC 8FAF0028 */ lw $t7, 0x28($sp)
|
||||
/* 066900 80065D00 00000000 */ nop
|
||||
/* 066904 80065D04 ACCF0018 */ sw $t7, 0x18($a2)
|
||||
/* 066908 80065D08 8FB80024 */ lw $t8, 0x24($sp)
|
||||
/* 06690C 80065D0C 00000000 */ nop
|
||||
/* 066910 80065D10 8F080008 */ lw $t0, 8($t8)
|
||||
/* 066914 80065D14 00000000 */ nop
|
||||
/* 066918 80065D18 8D04000C */ lw $a0, 0xc($t0)
|
||||
/* 06691C 80065D1C 00000000 */ nop
|
||||
/* 066920 80065D20 8C990008 */ lw $t9, 8($a0)
|
||||
/* 066924 80065D24 00000000 */ nop
|
||||
/* 066928 80065D28 0320F809 */ jalr $t9
|
||||
/* 06692C 80065D2C 00000000 */ nop
|
||||
.L80065D30:
|
||||
/* 066930 80065D30 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
.L80065D34:
|
||||
/* 066934 80065D34 27BD0020 */ addiu $sp, $sp, 0x20
|
||||
/* 066938 80065D38 03E00008 */ jr $ra
|
||||
/* 06693C 80065D3C 00000000 */ nop
|
||||
#glabel func_80065C38
|
||||
#/* 066838 80065C38 27BDFFE0 */ addiu $sp, $sp, -0x20
|
||||
#/* 06683C 80065C3C AFBF0014 */ sw $ra, 0x14($sp)
|
||||
#/* 066840 80065C40 AFA40020 */ sw $a0, 0x20($sp)
|
||||
#/* 066844 80065C44 AFA50024 */ sw $a1, 0x24($sp)
|
||||
#/* 066848 80065C48 AFA60028 */ sw $a2, 0x28($sp)
|
||||
#/* 06684C 80065C4C AFA7002C */ sw $a3, 0x2c($sp)
|
||||
#/* 066850 80065C50 8CAF0008 */ lw $t7, 8($a1)
|
||||
#/* 066854 80065C54 00000000 */ nop
|
||||
#/* 066858 80065C58 11E00036 */ beqz $t7, .L80065D34
|
||||
#/* 06685C 80065C5C 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
#/* 066860 80065C60 0C01959A */ jal func_80065668
|
||||
#/* 066864 80065C64 00000000 */ nop
|
||||
#/* 066868 80065C68 10400031 */ beqz $v0, .L80065D30
|
||||
#/* 06686C 80065C6C 00403025 */ move $a2, $v0
|
||||
#/* 066870 80065C70 8FA20024 */ lw $v0, 0x24($sp)
|
||||
#/* 066874 80065C74 8FB80020 */ lw $t8, 0x20($sp)
|
||||
#/* 066878 80065C78 8C480008 */ lw $t0, 8($v0)
|
||||
#/* 06687C 80065C7C 8F19001C */ lw $t9, 0x1c($t8)
|
||||
#/* 066880 80065C80 8D0900D8 */ lw $t1, 0xd8($t0)
|
||||
#/* 066884 80065C84 240B000D */ li $t3, 13
|
||||
#/* 066888 80065C88 03295021 */ addu $t2, $t9, $t1
|
||||
#/* 06688C 80065C8C ACCA0004 */ sw $t2, 4($a2)
|
||||
#/* 066890 80065C90 ACC00000 */ sw $zero, ($a2)
|
||||
#/* 066894 80065C94 A4CB0008 */ sh $t3, 8($a2)
|
||||
#/* 066898 80065C98 844C001A */ lh $t4, 0x1a($v0)
|
||||
#/* 06689C 80065C9C 00000000 */ nop
|
||||
#/* 0668A0 80065CA0 A4CC000A */ sh $t4, 0xa($a2)
|
||||
#/* 0668A4 80065CA4 93A40037 */ lbu $a0, 0x37($sp)
|
||||
#/* 0668A8 80065CA8 0C0196FB */ jal func_80065BEC
|
||||
#/* 0668AC 80065CAC AFA6001C */ sw $a2, 0x1c($sp)
|
||||
#/* 0668B0 80065CB0 8FA6001C */ lw $a2, 0x1c($sp)
|
||||
#/* 0668B4 80065CB4 00000000 */ nop
|
||||
#/* 0668B8 80065CB8 A0C20012 */ sb $v0, 0x12($a2)
|
||||
#/* 0668BC 80065CBC 87AD0032 */ lh $t5, 0x32($sp)
|
||||
#/* 0668C0 80065CC0 00000000 */ nop
|
||||
#/* 0668C4 80065CC4 A4CD0010 */ sh $t5, 0x10($a2)
|
||||
#/* 0668C8 80065CC8 93AE003B */ lbu $t6, 0x3b($sp)
|
||||
#/* 0668CC 80065CCC 00000000 */ nop
|
||||
#/* 0668D0 80065CD0 A0CE0013 */ sb $t6, 0x13($a2)
|
||||
#/* 0668D4 80065CD4 C7A4002C */ lwc1 $f4, 0x2c($sp)
|
||||
#/* 0668D8 80065CD8 00000000 */ nop
|
||||
#/* 0668DC 80065CDC E4C4000C */ swc1 $f4, 0xc($a2)
|
||||
#/* 0668E0 80065CE0 8FA5003C */ lw $a1, 0x3c($sp)
|
||||
#/* 0668E4 80065CE4 8FA40020 */ lw $a0, 0x20($sp)
|
||||
#/* 0668E8 80065CE8 0C0195F1 */ jal func_800657C4
|
||||
#/* 0668EC 80065CEC 00000000 */ nop
|
||||
#/* 0668F0 80065CF0 8FA6001C */ lw $a2, 0x1c($sp)
|
||||
#/* 0668F4 80065CF4 24050003 */ li $a1, 3
|
||||
#/* 0668F8 80065CF8 ACC20014 */ sw $v0, 0x14($a2)
|
||||
#/* 0668FC 80065CFC 8FAF0028 */ lw $t7, 0x28($sp)
|
||||
#/* 066900 80065D00 00000000 */ nop
|
||||
#/* 066904 80065D04 ACCF0018 */ sw $t7, 0x18($a2)
|
||||
#/* 066908 80065D08 8FB80024 */ lw $t8, 0x24($sp)
|
||||
#/* 06690C 80065D0C 00000000 */ nop
|
||||
#/* 066910 80065D10 8F080008 */ lw $t0, 8($t8)
|
||||
#/* 066914 80065D14 00000000 */ nop
|
||||
#/* 066918 80065D18 8D04000C */ lw $a0, 0xc($t0)
|
||||
#/* 06691C 80065D1C 00000000 */ nop
|
||||
#/* 066920 80065D20 8C990008 */ lw $t9, 8($a0)
|
||||
#/* 066924 80065D24 00000000 */ nop
|
||||
#/* 066928 80065D28 0320F809 */ jalr $t9
|
||||
#/* 06692C 80065D2C 00000000 */ nop
|
||||
#.L80065D30:
|
||||
#/* 066930 80065D30 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
#.L80065D34:
|
||||
#/* 066934 80065D34 27BD0020 */ addiu $sp, $sp, 0x20
|
||||
#/* 066938 80065D38 03E00008 */ jr $ra
|
||||
#/* 06693C 80065D3C 00000000 */ nop
|
||||
|
||||
glabel D_80065D40
|
||||
/* 066940 80065D40 27BDFFE0 */ addiu $sp, $sp, -0x20
|
||||
|
||||
+42
-42
@@ -34470,45 +34470,45 @@ glabel func_8009EC60
|
||||
/* 09F868 8009EC68 03E00008 */ jr $ra
|
||||
/* 09F86C 8009EC6C 31E20001 */ andi $v0, $t7, 1
|
||||
|
||||
glabel func_8009EC70
|
||||
/* 09F870 8009EC70 3C02800E */ lui $v0, %hi(D_800DF494) # $v0, 0x800e
|
||||
/* 09F874 8009EC74 8C42F494 */ lw $v0, %lo(D_800DF494)($v0)
|
||||
/* 09F878 8009EC78 03E00008 */ jr $ra
|
||||
/* 09F87C 8009EC7C 00000000 */ nop
|
||||
|
||||
glabel func_8009EC80
|
||||
/* 09F880 8009EC80 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
/* 09F884 8009EC84 AFBF0014 */ sw $ra, 0x14($sp)
|
||||
/* 09F888 8009EC88 0C0270B4 */ jal func_8009C2D0
|
||||
/* 09F88C 8009EC8C 00000000 */ nop
|
||||
/* 09F890 8009EC90 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
/* 09F894 8009EC94 10400003 */ beqz $v0, .L8009ECA4
|
||||
/* 09F898 8009EC98 00000000 */ nop
|
||||
/* 09F89C 8009EC9C 10000004 */ b .L8009ECB0
|
||||
/* 09F8A0 8009ECA0 00001025 */ move $v0, $zero
|
||||
.L8009ECA4:
|
||||
/* 09F8A4 8009ECA4 3C02800E */ lui $v0, %hi(D_800DF4C0) # $v0, 0x800e
|
||||
/* 09F8A8 8009ECA8 8C42F4C0 */ lw $v0, %lo(D_800DF4C0)($v0)
|
||||
/* 09F8AC 8009ECAC 00000000 */ nop
|
||||
.L8009ECB0:
|
||||
/* 09F8B0 8009ECB0 03E00008 */ jr $ra
|
||||
/* 09F8B4 8009ECB4 27BD0018 */ addiu $sp, $sp, 0x18
|
||||
|
||||
glabel func_8009ECB8
|
||||
/* 09F8B8 8009ECB8 3C02800E */ lui $v0, %hi(D_800DFD98) # $v0, 0x800e
|
||||
/* 09F8BC 8009ECBC 8C42FD98 */ lw $v0, %lo(D_800DFD98)($v0)
|
||||
/* 09F8C0 8009ECC0 00000000 */ nop
|
||||
/* 09F8C4 8009ECC4 304E0001 */ andi $t6, $v0, 1
|
||||
/* 09F8C8 8009ECC8 03E00008 */ jr $ra
|
||||
/* 09F8CC 8009ECCC 01C01025 */ move $v0, $t6
|
||||
|
||||
glabel func_8009ECD0
|
||||
/* 09F8D0 8009ECD0 3C02800E */ lui $v0, %hi(D_800DFD98) # $v0, 0x800e
|
||||
/* 09F8D4 8009ECD4 8C42FD98 */ lw $v0, %lo(D_800DFD98)($v0)
|
||||
/* 09F8D8 8009ECD8 00000000 */ nop
|
||||
/* 09F8DC 8009ECDC 304E0002 */ andi $t6, $v0, 2
|
||||
/* 09F8E0 8009ECE0 03E00008 */ jr $ra
|
||||
/* 09F8E4 8009ECE4 01C01025 */ move $v0, $t6
|
||||
|
||||
/* 09F8E8 8009ECE8 00000000 */ nop
|
||||
/* 09F8EC 8009ECEC 00000000 */ nop
|
||||
#glabel func_8009EC70
|
||||
#/* 09F870 8009EC70 3C02800E */ lui $v0, %hi(D_800DF494) # $v0, 0x800e
|
||||
#/* 09F874 8009EC74 8C42F494 */ lw $v0, %lo(D_800DF494)($v0)
|
||||
#/* 09F878 8009EC78 03E00008 */ jr $ra
|
||||
#/* 09F87C 8009EC7C 00000000 */ nop
|
||||
#
|
||||
#glabel func_8009EC80
|
||||
#/* 09F880 8009EC80 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
#/* 09F884 8009EC84 AFBF0014 */ sw $ra, 0x14($sp)
|
||||
#/* 09F888 8009EC88 0C0270B4 */ jal func_8009C2D0
|
||||
#/* 09F88C 8009EC8C 00000000 */ nop
|
||||
#/* 09F890 8009EC90 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
#/* 09F894 8009EC94 10400003 */ beqz $v0, .L8009ECA4
|
||||
#/* 09F898 8009EC98 00000000 */ nop
|
||||
#/* 09F89C 8009EC9C 10000004 */ b .L8009ECB0
|
||||
#/* 09F8A0 8009ECA0 00001025 */ move $v0, $zero
|
||||
#.L8009ECA4:
|
||||
#/* 09F8A4 8009ECA4 3C02800E */ lui $v0, %hi(D_800DF4C0) # $v0, 0x800e
|
||||
#/* 09F8A8 8009ECA8 8C42F4C0 */ lw $v0, %lo(D_800DF4C0)($v0)
|
||||
#/* 09F8AC 8009ECAC 00000000 */ nop
|
||||
#.L8009ECB0:
|
||||
#/* 09F8B0 8009ECB0 03E00008 */ jr $ra
|
||||
#/* 09F8B4 8009ECB4 27BD0018 */ addiu $sp, $sp, 0x18
|
||||
#
|
||||
#glabel func_8009ECB8
|
||||
#/* 09F8B8 8009ECB8 3C02800E */ lui $v0, %hi(D_800DFD98) # $v0, 0x800e
|
||||
#/* 09F8BC 8009ECBC 8C42FD98 */ lw $v0, %lo(D_800DFD98)($v0)
|
||||
#/* 09F8C0 8009ECC0 00000000 */ nop
|
||||
#/* 09F8C4 8009ECC4 304E0001 */ andi $t6, $v0, 1
|
||||
#/* 09F8C8 8009ECC8 03E00008 */ jr $ra
|
||||
#/* 09F8CC 8009ECCC 01C01025 */ move $v0, $t6
|
||||
#
|
||||
#glabel func_8009ECD0
|
||||
#/* 09F8D0 8009ECD0 3C02800E */ lui $v0, %hi(D_800DFD98) # $v0, 0x800e
|
||||
#/* 09F8D4 8009ECD4 8C42FD98 */ lw $v0, %lo(D_800DFD98)($v0)
|
||||
#/* 09F8D8 8009ECD8 00000000 */ nop
|
||||
#/* 09F8DC 8009ECDC 304E0002 */ andi $t6, $v0, 2
|
||||
#/* 09F8E0 8009ECE0 03E00008 */ jr $ra
|
||||
#/* 09F8E4 8009ECE4 01C01025 */ move $v0, $t6
|
||||
#
|
||||
#/* 09F8E8 8009ECE8 00000000 */ nop
|
||||
#/* 09F8EC 8009ECEC 00000000 */ nop
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
def add_custom_arguments(parser):
|
||||
group = parser.add_mutually_exclusive_group(required=False)
|
||||
group.add_argument('-j', dest='lang', action='store_const', const='jp',
|
||||
help="Set version to JP.")
|
||||
group.add_argument('-u', dest='lang', action='store_const', const='us',
|
||||
help="Set version to US.")
|
||||
group.add_argument('-e', dest='lang', action='store_const', const='eu',
|
||||
help="Set version to EU.")
|
||||
group.add_argument('-s', dest='lang', action='store_const', const='sh',
|
||||
help="Set version to SH.")
|
||||
|
||||
def apply(config, args):
|
||||
lang = args.lang or 'us'
|
||||
config['mapfile'] = f'build/dkr.map'
|
||||
config['myimg'] = f'build/dkr.z64'
|
||||
config['baseimg'] = f'baseroms/Diddy Kong Racing (USA 1.0).z64'
|
||||
config['makeflags'] = [f'']
|
||||
config['source_directories'] = ['src']
|
||||
@@ -0,0 +1,65 @@
|
||||
#ifndef _MACROS_H_
|
||||
#define _MACROS_H_
|
||||
|
||||
#ifndef __sgi
|
||||
#define GLOBAL_ASM(...)
|
||||
#endif
|
||||
|
||||
#if !defined(__sgi) && (!defined(NON_MATCHING) || !defined(AVOID_UB))
|
||||
// asm-process isn't supported outside of IDO, and undefined behavior causes
|
||||
// crashes.
|
||||
#error Matching build is only possible on IDO; please build with NON_MATCHING=1.
|
||||
#endif
|
||||
|
||||
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
#define GLUE(a, b) a ## b
|
||||
#define GLUE2(a, b) GLUE(a, b)
|
||||
|
||||
// Avoid compiler warnings for unused variables
|
||||
#ifdef __GNUC__
|
||||
#define UNUSED __attribute__((unused))
|
||||
#else
|
||||
#define UNUSED
|
||||
#endif
|
||||
|
||||
// Avoid undefined behaviour for non-returning functions
|
||||
#ifdef __GNUC__
|
||||
#define NORETURN __attribute__((noreturn))
|
||||
#else
|
||||
#define NORETURN
|
||||
#endif
|
||||
|
||||
// Static assertions
|
||||
#ifdef __GNUC__
|
||||
#define STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
|
||||
#else
|
||||
#define STATIC_ASSERT(cond, msg) typedef char GLUE2(static_assertion_failed, __LINE__)[(cond) ? 1 : -1]
|
||||
#endif
|
||||
|
||||
// Align to 8-byte boundary for DMA requirements
|
||||
#ifdef __GNUC__
|
||||
#define ALIGNED8 __attribute__((aligned(8)))
|
||||
#else
|
||||
#define ALIGNED8
|
||||
#endif
|
||||
|
||||
// Align to 16-byte boundary for audio lib requirements
|
||||
#ifdef __GNUC__
|
||||
#define ALIGNED16 __attribute__((aligned(16)))
|
||||
#else
|
||||
#define ALIGNED16
|
||||
#endif
|
||||
|
||||
// convert a virtual address to physical.
|
||||
#define VIRTUAL_TO_PHYSICAL(addr) ((uintptr_t)(addr) & 0x1FFFFFFF)
|
||||
|
||||
// convert a physical address to virtual.
|
||||
#define PHYSICAL_TO_VIRTUAL(addr) ((uintptr_t)(addr) | 0x80000000)
|
||||
|
||||
// another way of converting virtual to physical
|
||||
#define VIRTUAL_TO_PHYSICAL2(addr) ((u8 *)(addr) - 0x80000000U)
|
||||
|
||||
#define ABSF(x) (x < 0.f ? -x : x)
|
||||
|
||||
#endif
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned long u64;
|
||||
typedef signed char s8;
|
||||
typedef signed short s16;
|
||||
typedef signed int s32;
|
||||
typedef signed long s64;
|
||||
typedef float f32;
|
||||
typedef double f64;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/* The comment below is needed for this file to be picked up by generate_ld */
|
||||
/* RAM_POS: 0x80065BD0 */
|
||||
|
||||
#include "types.h"
|
||||
#include "macros.h"
|
||||
|
||||
extern s16 D_800DD050;
|
||||
|
||||
void func_80065BD0(s32 arg0) {
|
||||
D_800DD050 = arg0;
|
||||
}
|
||||
|
||||
/* Unused? */
|
||||
s16 func_80065BDC(void) {
|
||||
return D_800DD050;
|
||||
}
|
||||
|
||||
s32 func_80065BEC(s32 arg0) {
|
||||
switch(D_800DD050) {
|
||||
case 0:
|
||||
return arg0;
|
||||
case 2:
|
||||
arg0 = ((arg0 - 0x40) >> 1) + 0x40;
|
||||
return arg0;
|
||||
case 1:
|
||||
default:
|
||||
return 0x40;
|
||||
}
|
||||
}
|
||||
|
||||
GLOBAL_ASM("asm/non_matchings/func_80065C38.s")
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/* The comment below is needed for this file to be picked up by generate_ld */
|
||||
/* RAM_POS: 0x8009EC70 */
|
||||
|
||||
#include "types.h"
|
||||
|
||||
extern s32 D_800DF494;
|
||||
extern s32 D_800DFD98;
|
||||
extern s32 D_800DF4C0;
|
||||
|
||||
s32 func_8009EC70(void) {
|
||||
return D_800DF494;
|
||||
}
|
||||
|
||||
s32 func_8009EC80(void) {
|
||||
if (func_8009C2D0() != 0) {
|
||||
return 0;
|
||||
}
|
||||
return D_800DF4C0;
|
||||
}
|
||||
|
||||
s32 func_8009ECB8(void) {
|
||||
return D_800DFD98 & 1;
|
||||
}
|
||||
|
||||
s32 func_8009ECD0(void) {
|
||||
return D_800DFD98 & 2;
|
||||
}
|
||||
Executable
+868
File diff suppressed because it is too large
Load Diff
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
asm_processor = ['python3', os.path.join(dir_path, "asm-processor.py")]
|
||||
prelude = os.path.join(dir_path, "prelude.inc")
|
||||
|
||||
all_args = sys.argv[1:]
|
||||
sep1 = all_args.index('--')
|
||||
sep2 = all_args.index('--', sep1+1)
|
||||
|
||||
compiler = all_args[:sep1]
|
||||
|
||||
assembler = all_args[sep1+1:sep2]
|
||||
assembler_sh = ' '.join(shlex.quote(x) for x in assembler)
|
||||
|
||||
compile_args = all_args[sep2+1:]
|
||||
in_file = compile_args[-1]
|
||||
out_ind = compile_args.index('-o')
|
||||
out_file = compile_args[out_ind + 1]
|
||||
del compile_args[-1]
|
||||
del compile_args[out_ind + 1]
|
||||
del compile_args[out_ind]
|
||||
|
||||
in_dir = os.path.split(os.path.realpath(in_file))[0]
|
||||
opt_flags = [x for x in compile_args if x in ['-g', '-O2', '-framepointer']]
|
||||
|
||||
preprocessed_file = tempfile.NamedTemporaryFile(prefix='preprocessed', suffix='.c')
|
||||
|
||||
subprocess.check_call(asm_processor + opt_flags + [in_file], stdout=preprocessed_file)
|
||||
subprocess.check_call(compiler + compile_args + ['-I', in_dir, '-o', out_file, preprocessed_file.name])
|
||||
subprocess.check_call(asm_processor + opt_flags + [in_file, '--post-process', out_file, '--assembler', assembler_sh, '--asm-prelude', prelude])
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
.include "globals.inc"
|
||||
.include "macros.inc"
|
||||
|
||||
# assembler directives
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # dont insert nops after branches
|
||||
.set gp=64 # 64-bit instructions are used
|
||||
@@ -7,6 +7,7 @@ from file_util import FileUtil
|
||||
|
||||
LD_NAME = 'dkr.ld'
|
||||
ASM_DIR = './asm'
|
||||
SRC_DIR = './src'
|
||||
ASSETS_S_FILENAME = './asm/assets/assets.s'
|
||||
ASSETS_DIR = './assets/us_1.0'
|
||||
ASSETS_START = 0x0D8200
|
||||
@@ -15,7 +16,7 @@ class LD:
|
||||
def __init__(self, file):
|
||||
print('Generating linker file...')
|
||||
self.generate_assets_file()
|
||||
self.files = self.get_asm_files()
|
||||
self.files = self.get_code_files()
|
||||
self.indentLevel = 0
|
||||
self.file = file
|
||||
self.gen_comment('linker script generated by generate_ld.py')
|
||||
@@ -118,8 +119,8 @@ class LD:
|
||||
def gen_newline(self):
|
||||
self.file.write('\n')
|
||||
|
||||
def get_asm_files(self):
|
||||
asmFiles = []
|
||||
def get_code_files(self):
|
||||
files = []
|
||||
asmFilenames = FileUtil.get_filenames_from_directory(ASM_DIR, ('.s',))
|
||||
regex = r'[\/][*]\s*([0-9A-Fa-f]{6})\s*([0-9A-Fa-f]{8})\s*([0-9A-Fa-f]{8})\s*[*][\/]'
|
||||
for filename in asmFilenames:
|
||||
@@ -132,10 +133,24 @@ class LD:
|
||||
line = asmFile.readline()
|
||||
continue
|
||||
matchedGroups = matches.groups()
|
||||
asmFiles.append(('build/asm/' + filename[:-2] + '.o', matchedGroups[0], matchedGroups[1]))
|
||||
files.append(('build/asm/' + filename[:-2] + '.o', matchedGroups[0], matchedGroups[1], 1))
|
||||
break
|
||||
asmFiles.sort(key = lambda x: x[2]) # Sort tuples by RAM address
|
||||
return asmFiles
|
||||
srcFilenames = FileUtil.get_filenames_from_directory(SRC_DIR, ('.c',))
|
||||
regex = r'[\/][*]+\s*RAM_POS:\s*0x([0-9a-fA-F]+)\s*[*]+[\/]'
|
||||
for filename in srcFilenames:
|
||||
with open(SRC_DIR + '/' + filename, 'r') as srcFile:
|
||||
notDone = True
|
||||
line = srcFile.readline()
|
||||
while line:
|
||||
matches = re.match(regex, line)
|
||||
if matches is None:
|
||||
line = srcFile.readline()
|
||||
continue
|
||||
matchedGroups = matches.groups()
|
||||
files.append(('build/src/' + filename[:-2] + '.o', '', matchedGroups[0], 0))
|
||||
break
|
||||
files.sort(key = lambda x: (x[2], x[3])) # Sort tuples by RAM address and prioritize src files first.
|
||||
return files
|
||||
|
||||
def get_asset_files(self):
|
||||
assetFiles = []
|
||||
|
||||
Reference in New Issue
Block a user