Introduce IDO 7.1 to the project and decompile func0003b9d4

This commit is contained in:
Ryan Dwyer 2021-10-15 23:44:10 +10:00
parent 7163ea66b3
commit f1a239a8be
36 changed files with 1315 additions and 64 deletions

View File

@ -3,15 +3,26 @@
ROMID ?= ntsc-final
PIRACYCHECKS ?= 1
QEMU_IRIX ?= tools/irix/qemu-irix
IRIX_ROOT ?= tools/irix/root
# In PD, some code is compiled with IDO 5.3 and some is IDO 7.1.
# The project provides both versions of the IDO compiler so that the project can
# be compiled out of the box by running these compilers using qemu-irix.
# Recomp can be used for almost all files, but some must be compiled with qemu.
IDOCC ?= $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc
# These are the qemu-irix versions. These variables are constant.
CCQEMU53 = tools/irix/qemu-irix -silent -L tools/irix/root53 tools/irix/root53/usr/bin/cc
CCQEMU71 = tools/irix/qemu-irix -silent -L tools/irix/root71 tools/irix/root71/usr/bin/cc
# The user can use recomp by setting $CC53 and $CC71 in their environment.
# If not set, fall back to using the qemu-irix compilers.
CC53 ?= $(CCQEMU53)
CC71 ?= $(CCQEMU71)
# By default we'll compile everything using 5.3,
# as this is what most of the project uses.
CC := $(CC53)
################################################################################
QEMUCC = $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc
export ROMID
NTSC=0
@ -151,11 +162,15 @@ O3_C_FILES := \
src/lib/ultra/gu/ortho.c \
src/lib/ultra/gu/scale.c
IDO71_C_FILES := \
$(shell find src/lib/naudio -name '*.c')
LOOPUNROLL_O_FILES = $(patsubst src/%.c, $(B_DIR)/%.o, $(LOOPUNROLL_C_FILES))
MIPS3_O_FILES = $(patsubst src/%.c, $(B_DIR)/%.o, $(MIPS3_C_FILES))
G_O_FILES = $(patsubst src/%.c, $(B_DIR)/%.o, $(G_C_FILES))
O1_O_FILES = $(patsubst src/%.c, $(B_DIR)/%.o, $(O1_C_FILES))
O3_O_FILES = $(patsubst src/%.c, $(B_DIR)/%.o, $(O3_C_FILES))
IDO71_O_FILES = $(patsubst src/%.c, $(B_DIR)/%.o, $(IDO71_C_FILES))
LOOPUNROLL := -Wo,-loopunroll,0
MIPSISET := -mips2 -32
@ -166,6 +181,7 @@ $(MIPS3_O_FILES): MIPSISET := -mips3 -32
$(G_O_FILES): OPT_LVL := -g
$(O1_O_FILES): OPT_LVL := -O1
$(O3_O_FILES): OPT_LVL := -O3
$(IDO71_O_FILES): CC := $(CC71)
CFLAGS = $(C_DEFINES) \
$(LOOPUNROLL) \
@ -190,16 +206,17 @@ C_FILES := $(shell find src/lib src/game src/inflate -name '*.c')
S_FILES := $(shell find src/lib src/game src/preamble -name '*.s')
# Files containing MAXFLOAT must be built with qemu, not recomp
# And luckily this only occurs in 5.3 code, so we can force CCQEMU53 here
MAXFLOAT_C_FILES != grep -rl 'MAXFLOAT' $(C_FILES)
MAXFLOAT_O_FILES = $(patsubst src/%.c, $(B_DIR)/%.o, $(MAXFLOAT_C_FILES))
$(MAXFLOAT_O_FILES): IDOCC := $(QEMUCC)
$(MAXFLOAT_O_FILES): CC := $(CCQEMU53)
# Files containing GLOBAL_ASM must be built with the asm_processor
GLOBALASM_C_FILES != grep -rl 'GLOBAL_ASM(' $(C_FILES)
GLOBALASM_O_FILES = $(patsubst src/%.c, $(B_DIR)/%.o, $(GLOBALASM_C_FILES))
$(GLOBALASM_O_FILES): IDOCC := /usr/bin/env python3 tools/asm_processor/build.py $(IDOCC) -- $(TOOLCHAIN)-as $(ASFLAGS) --
$(GLOBALASM_O_FILES): CC := /usr/bin/env python3 tools/asm_processor/build.py $(CC) -- $(TOOLCHAIN)-as $(ASFLAGS) --
# Create names such as $(B_DIR)/assets/files/PfooZ.
# These names (with .o added) will be dependenices for ld.
@ -446,7 +463,7 @@ $(B_DIR)/assets/files/P%Z: $(A_DIR)/files/props/%.bin
# Or create $(A_DIR)/files/setup/foo.bin to skip the earlier steps
$(B_DIR)/assets/files/setup/%.o: src/files/setup/%.c $(ASSETMGR_O_FILES)
@mkdir -p $(dir $@)
$(IDOCC) -c $(CFLAGS) -o $@ $<
$(CC) -c $(CFLAGS) -o $@ $<
$(B_DIR)/assets/files/setup/%.elf: $(B_DIR)/assets/files/setup/%.o
TOOLCHAIN=$(TOOLCHAIN) tools/mksimpleelf $< $@
@ -493,17 +510,17 @@ $(B_DIR)/rsp/%.o: $(E_DIR)/rsp/%.bin
$(B_DIR)/lib/ultra/libc/llcvt.o: src/lib/ultra/libc/llcvt.c $(ASSETMGR_O_FILES)
@mkdir -p $(dir $@)
$(IDOCC) -c $(CFLAGS) -o $@ $<
$(CC) -c $(CFLAGS) -o $@ $<
tools/patchmips3 $@ || rm $@
$(B_DIR)/lib/ultra/libc/ll.o: src/lib/ultra/libc/ll.c $(ASSETMGR_O_FILES)
@mkdir -p $(dir $@)
$(IDOCC) -c $(CFLAGS) $< -o $@
$(CC) -c $(CFLAGS) $< -o $@
tools/patchmips3 $@ || rm $@
$(B_DIR)/%.o: src/%.c $(ASSETMGR_O_FILES)
@mkdir -p $(dir $@)
$(IDOCC) -c $(CFLAGS) -o $@ $<
$(CC) -c $(CFLAGS) -o $@ $<
$(B_DIR)/%.o: src/%.s
@mkdir -p $(dir $@)
@ -511,7 +528,7 @@ $(B_DIR)/%.o: src/%.s
$(B_DIR)/assets/%.o: $(A_DIR)/%.c
@mkdir -p $(dir $@)
$(IDOCC) -c $(CFLAGS) -o $@ $<
$(CC) -c $(CFLAGS) -o $@ $<
extract:
ROMID=$(ROMID) tools/extract

View File

@ -9,7 +9,7 @@ u32 func0003b178(void);
u32 func0003b370(void);
u32 func0003b54c(void);
u32 func0003b710(void);
u32 func0003b9d4(void);
f32 func0003b9d4(s32 arg0);
u32 func0003ba64(void);
#endif

View File

@ -160,57 +160,31 @@ void _init_lpfilter(ALLowPass *lp)
}
}
GLOBAL_ASM(
glabel func0003b9d4
.late_rodata
glabel var70054ac8
.word 0x3f879c7d
glabel var70054acc
.word 0x3f71a1bf
.text
/* 3b9d4: 27bdfff8 */ addiu $sp,$sp,-8
/* 3b9d8: 3c013f80 */ lui $at,0x3f80
/* 3b9dc: 44812000 */ mtc1 $at,$f4
/* 3b9e0: 00000000 */ nop
/* 3b9e4: e7a40000 */ swc1 $f4,0x0($sp)
/* 3b9e8: 04800005 */ bltz $a0,.L0003ba00
/* 3b9ec: 00000000 */ nop
/* 3b9f0: 3c017005 */ lui $at,%hi(var70054ac8)
/* 3b9f4: c4264ac8 */ lwc1 $f6,%lo(var70054ac8)($at)
/* 3b9f8: 10000005 */ b .L0003ba10
/* 3b9fc: e7a60004 */ swc1 $f6,0x4($sp)
.L0003ba00:
/* 3ba00: 3c017005 */ lui $at,%hi(var70054acc)
/* 3ba04: c4284acc */ lwc1 $f8,%lo(var70054acc)($at)
/* 3ba08: e7a80004 */ swc1 $f8,0x4($sp)
/* 3ba0c: 00042023 */ negu $a0,$a0
.L0003ba10:
/* 3ba10: 1080000e */ beqz $a0,.L0003ba4c
/* 3ba14: 00000000 */ nop
.L0003ba18:
/* 3ba18: 308e0001 */ andi $t6,$a0,0x1
/* 3ba1c: 11c00005 */ beqz $t6,.L0003ba34
/* 3ba20: 00000000 */ nop
/* 3ba24: c7aa0000 */ lwc1 $f10,0x0($sp)
/* 3ba28: c7b00004 */ lwc1 $f16,0x4($sp)
/* 3ba2c: 46105482 */ mul.s $f18,$f10,$f16
/* 3ba30: e7b20000 */ swc1 $f18,0x0($sp)
.L0003ba34:
/* 3ba34: c7a40004 */ lwc1 $f4,0x4($sp)
/* 3ba38: 46042182 */ mul.s $f6,$f4,$f4
/* 3ba3c: e7a60004 */ swc1 $f6,0x4($sp)
/* 3ba40: 00042043 */ sra $a0,$a0,0x1
/* 3ba44: 1480fff4 */ bnez $a0,.L0003ba18
/* 3ba48: 00000000 */ nop
.L0003ba4c:
/* 3ba4c: 10000003 */ b .L0003ba5c
/* 3ba50: c7a00000 */ lwc1 $f0,0x0($sp)
/* 3ba54: 10000001 */ b .L0003ba5c
/* 3ba58: 00000000 */ nop
.L0003ba5c:
/* 3ba5c: 03e00008 */ jr $ra
/* 3ba60: 27bd0008 */ addiu $sp,$sp,0x8
);
f32 func0003b9d4(s32 arg0)
{
f32 mult;
f32 value;
value = 1.0f;
if (arg0 >= 0) {
mult = 1.0594631433487f;
} else {
mult = 0.94387429952621f;
arg0 = -arg0;
}
while (arg0) {
if (arg0 & 1) {
value *= mult;
}
mult *= mult;
arg0 >>= 1;
}
return value;
}
GLOBAL_ASM(
glabel func0003ba64

Binary file not shown.

Binary file not shown.

BIN
tools/irix/root71/lib/rld Executable file

Binary file not shown.

BIN
tools/irix/root71/usr/bin/cc Executable file

Binary file not shown.

BIN
tools/irix/root71/usr/lib/as1 Executable file

Binary file not shown.

BIN
tools/irix/root71/usr/lib/cfe Executable file

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
tools/irix/root71/usr/lib/ugen Executable file

Binary file not shown.

BIN
tools/irix/root71/usr/lib/umerge Executable file

Binary file not shown.

BIN
tools/irix/root71/usr/lib/uopt Executable file

Binary file not shown.