diff --git a/.gitignore b/.gitignore index f7dc8467..ac47eb43 100644 --- a/.gitignore +++ b/.gitignore @@ -53,8 +53,11 @@ undefined_syms*.txt # Linker scripts *.ld +# Python +env/ +__pycache__/ +*.pyc + # Miscellaneous .vscode temp/ -__pycache__/ -*.pyc diff --git a/Makefile b/Makefile index 1f6648a1..c10bf80b 100644 --- a/Makefile +++ b/Makefile @@ -2,13 +2,14 @@ NAME := SCUS_971.98 TARGET := ee TARGETTYPE := bin -ASM_PATH := asm -ASSET_PATH := assets +ASM_PATH := asm/ +ASSET_PATH := assets/ +SPLAT_C_PATH := c/ SDIR = src/P2 IDIR = include VPATH := $(SDIR) -SRCS := $(wildcard $(SDIR)/*.cpp) $(wildcard $(SDIR)/*.c) +SRCS := $(shell find $(SDIR) -name '*.cpp' -or -name '*.c') # Output LD_SCRIPT := sly1.ld @@ -25,7 +26,7 @@ CCINCLUDES = -I$(SCE_COMMON)/include -I$(SCE_EE)/include -I$(IDIR) CCFLAGS = -Wall -Wno-unused $(BASEFLAGS) -fno-strict-aliasing $(CCINCLUDES) $(CCDEFINES) CXXFLAGS = $(CCFLAGS) LDLIBS = -L$(SCE_EE)/lib -lsn -lc -lm -lpad -lmpeg -ldma -lipu -lkernl -LDFLAGS = -nostartfiles -Wl,-Map,../../$(OUTDIR)/$(NAME).map -T$(SCE_EE)/lib/app.cmd $(LDLIBS) +LDFLAGS = -nostartfiles -Wl,-Map,$(realpath $(OUTDIR)/$(NAME).map) -T$(SCE_EE)/lib/app.cmd $(LDLIBS) include build/core.mk @@ -36,7 +37,7 @@ all: $(OUTDIR)/$(NAME) clean: clean-products $(RM) -f $(OUTDIR)/*$(NAME).map $(SDIR)/*.o - $(RM) -rf $(ASM_PATH) $(ASSET_PATH) $(LD_SCRIPT) + $(RM) -rf $(ASM_PATH) $(ASSET_PATH) $(SPLAT_C_PATH) $(LD_SCRIPT) extract: $(RM) -r asm/ $(LD_SCRIPT) diff --git a/build/ee-bin.mk b/build/ee-bin.mk index 816c32e0..989b8511 100644 --- a/build/ee-bin.mk +++ b/build/ee-bin.mk @@ -5,7 +5,7 @@ OUTDIR := bin/$(CONFIG) # This incantation is done to avoid modifying the SCE linker scripts. $(OUTDIR)/$(NAME): $(OBJDIR)/ $(OUTDIR)/ $(OBJS) - cd $(OBJDIR)/ && $(CXX) $(CXXFLAGS) -o ../../$@ $(notdir $(OBJS)) $(LDFLAGS) + cd $(OBJDIR)/ && $(CXX) $(CXXFLAGS) -o ../../$@ $(OBJS:$(OBJDIR)/%=%) $(LDFLAGS) # :( have to duplicate the rule $(OBJDIR)/crt0.o: $(CRT0_S) diff --git a/build/ee-common.mk b/build/ee-common.mk index 729a2c6d..5d661bfa 100644 --- a/build/ee-common.mk +++ b/build/ee-common.mk @@ -10,10 +10,9 @@ CXX := $(SCE_EE_GCC)/bin/ee-gcc.exe CRT0_S := $(SCE_EE)/lib/crt0.s endif -# Scary Make Incantations: Volume 1 -OBJS := $(patsubst %.cpp,$(OBJDIR)/%.o,$(filter %.cpp,$(notdir $(SRCS)))) -OBJS += $(patsubst %.c,$(OBJDIR)/%.o,$(filter %.c,$(notdir $(SRCS)))) -OBJS += $(patsubst %.s,$(OBJDIR)/%.o,$(filter %.s,$(notdir $(SRCS)))) +# Rewrite the object files to maintain directory structure +OBJS := $(patsubst $(SDIR)/%,$(OBJDIR)/%,$(SRCS:.cpp=.o)) +OBJS := $(patsubst $(SDIR)/%,$(OBJDIR)/%,$(OBJS:.c=.o)) # shared for both c/c++ compilation BASEFLAGS := -G0 -fno-common @@ -27,10 +26,13 @@ BASEFLAGS += -O2 endif $(OBJDIR)/%.o: %.s + mkdir -p $(@D) $(CC) -c -xassembler-with-cpp $(CCFLAGS) $< -o $@ $(OBJDIR)/%.o: %.c + mkdir -p $(@D) $(CC) -x c++ -c $(CCFLAGS) $< -o $@ $(OBJDIR)/%.o: %.cpp + mkdir -p $(@D) $(CXX) -c $(CXXFLAGS) $< -o $@ diff --git a/config/sly1.yaml b/config/sly1.yaml index ab2dfddc..fa024137 100644 --- a/config/sly1.yaml +++ b/config/sly1.yaml @@ -9,8 +9,8 @@ options: platform: ps2 compiler: GCC - asm_path: splat/release/asm - src_path: splat/release/src + asm_path: asm + src_path: c build_path: build find_file_boundaries: False @@ -43,215 +43,226 @@ segments: bss_size: 0x3B1304 subsegments: - [0x001000, asm, sce/crt0] # starts with 2 nops - - [0x001178, c, P2/ps2t/spaprops] # ext should be .ic + - [0x001178, asm, P2/ps2t/spaprops] # ext should be .ic #---------------------------------------- # Splice sources + # All .cpp files #---------------------------------------- - - [0x13698, cpp, P2/splice/bif] - - [0x19d48, cpp, P2/splice/eval] - - [0x1b328, cpp, P2/splice/frame] - - [0x1b678, cpp, P2/splice/gc] - - [0x1be78, cpp, P2/splice/method] - - [0x1bf98, cpp, P2/splice/pair] - - [0x1bf98, cpp, P2/splice/proc] - - [0x1c008, cpp, P2/splice/ref] - - [0x1ca28, cpp, P2/splice/serialize] - - [0x1cd28, cpp, P2/splice/sidebag] - - [0x1cf70, cpp, P2/splice/spliceutils] - - [0x1d128, cpp, P2/splice/splotheap] - - [0x1d508, cpp, P2/splice/vecmat] + - [0x13698, asm, P2/splice/bif] + - [0x19d48, asm, P2/splice/eval] + - [0x1b328, asm, P2/splice/frame] + - [0x1b678, asm, P2/splice/gc] + - [0x1be78, asm, P2/splice/method] + - [0x1bf98, asm, P2/splice/pair] + - [0x1bf98, asm, P2/splice/proc] + - [0x1c008, asm, P2/splice/ref] + - [0x1ca28, asm, P2/splice/serialize] + - [0x1cd28, asm, P2/splice/sidebag] + - [0x1cf70, asm, P2/splice/spliceutils] + - [0x1d128, asm, P2/splice/splotheap] + - [0x1d508, asm, P2/splice/vecmat] #---------------------------------------- # P2 sources + # All .c files (but compiled as c++) #---------------------------------------- - - [0x1dbb8, c, P2/989snd] - - [0x1f560, c, P2/brx] - - [0x1fe70, c, P2/ac] - #act - #actseg - - [0x243c0, c, P2/alarm] - - [0x24dc0, c, P2/alo] - #aseg - #asega - #barrier - - [0x30cf0, c, P2/bas] - - [0x310e8, c, P2/basic] - - [0x31168, c, P2/bez] - - [0x31f48, c, P2/binoc] - - [0x38290, c, P2/bis] - - [0x395a0, c, P2/bbmark] - - [0x39ff0, c, P2/blend] - - [0x3ab70, c, P2/blip] - - [0x3c4c0, c, P2/bomb] - #bone - #bq - - [0x3dcf8, c, P2/break] - #bsp - #button - #cat (might not be in release) - #can - - [0x417a8, c, P2/cd] - - [0x41d90, c, P2/chkpnt] - - [0x429e8, c, P2/clip] - - [0x43ed0, c, P2/clock] - - [0x44148, c, P2/cm] - - [0x47100, c, P2/cnvo] - - [0x491A0, c, P2/coin] - - [0x4a398, c, P2/cplcy] - - [0x4bbd0, c, P2/credit] - - [0x4c0c0, c, P2/crout] - #crusher - - [0x4e0a8, c, P2/crv] - #dart - #dartgun - #dialog - - [0x529e0, c, P2/difficulty] - - [0x53438, c, P2/dl] - - [0x53810, c, P2/dmas] - #dsp - #dysh - #dzg - - [0x559c8, c, P2/emitter] - #eyes - - [0x5aad0, c, P2/fader] - #find - - [0x5b8b0, c, P2/flash] - - [0x5bae0, c, P2/fly] - - [0x5d188, c, P2/font] - - [0x5f810, c, P2/frm] - - [0x60678, c, P2/freeze] - - [0x60f88, c, P2/frzg] - - [0x61070, c, P2/game] - - [0x61e80, c, P2/geom] - #gifs - #glbs - #glob - #gomer - - [0x69130, c, P2/gs] - - [0x6ac58, c, P2/hide] - #hnd - #ik - #jack - #jlo - - [0x6f0b8, c, P2/joy] - - [0x70608, c, P2/jt] - #jp - #jsg - - [0x7e248, c, P2/jump] - #keyhole - #landing - #lgn - - [0x83c18, c, P2/lo] - - [0x84cc8, c, P2/light] - - [0x86358, c, P2/lookat] - - [0x86758, c, P2/main] - - [0x86c18, c, P2/mark] - - [0x894c0, c, P2/mat] + - [0x1dbb8, asm, P2/989snd] + - [0x1f560, asm, P2/brx] + - [0x1fe70, asm, P2/ac] + #- [0x, asm, P2/act] + #- [0x, asm, P2/actseg] + - [0x243c0, asm, P2/alarm] + - [0x24dc0, asm, P2/alo] + #- [0x, asm, P2/aseg] + #- [0x, asm, P2/asega] + #- [0x, asm, P2/barrier] + - [0x30cf0, asm, P2/bas] + - [0x310e8, asm, P2/basic] + - [0x31168, asm, P2/bez] + - [0x31f48, asm, P2/binoc] + - [0x38290, asm, P2/bis] + - [0x395a0, asm, P2/bbmark] + - [0x39ff0, asm, P2/blend] + - [0x3ab70, asm, P2/blip] + - [0x3c4c0, asm, P2/bomb] + #- [0x, asm, P2/bone] + #- [0x, asm, P2/bq] + - [0x3dcf8, asm, P2/break] + + - [0x3efd8, asm] # TODO + #- [0x, asm, P2/bsp] + #- [0x, asm, P2/button] + #- [0x, asm, P2/cat] (might not be in release) + #- [0x, asm, P2/can] + + - [0x417a8, asm, P2/cd] + - [0x41d90, asm, P2/chkpnt] + - [0x429e8, asm, P2/clip] + - [0x43ed0, asm, P2/clock] + - [0x44148, asm, P2/cm] + - [0x47100, asm, P2/cnvo] + - [0x491A0, asm, P2/coin] + - [0x4a398, asm, P2/cplcy] + - [0x4bbd0, asm, P2/credit] + - [0x4c0c0, asm, P2/crout] + #- [0x, asm, P2/crusher] + - [0x4e0a8, asm, P2/crv] + - [0x4fe40, asm, P2/dart] + #- [0x, asm, P2/dartgun] + #- [0x, asm, P2/dialog] + - [0x529e0, asm, P2/difficulty] + - [0x53438, asm, P2/dl] + - [0x53810, asm, P2/dmas] + #- [0x, asm, P2/dsp] + #- [0x, asm, P2/dysh] + #- [0x, asm, P2/dzg] + - [0x559c8, asm, P2/emitter] + - [0x5a6e0, asm, P2/eyes] + - [0x5aad0, asm, P2/fader] + + - [0x5aca0, asm] #? unknown file + + - [0x5af20, asm, P2/find] + - [0x5b8b0, asm, P2/flash] + - [0x5bae0, asm, P2/fly] + - [0x5d188, asm, P2/font] + - [0x5f810, asm, P2/frm] + - [0x60678, asm, P2/freeze] + - [0x60f88, asm, P2/frzg] + - [0x61070, asm, P2/game] + - [0x61e80, asm, P2/geom] + #- [0x, asm, P2/gifs] + #- [0x, asm, P2/glbs] + #- [0x, asm, P2/glob] + #- [0x, asm, P2/gomer] + - [0x69130, asm, P2/gs] + - [0x6ac58, asm, P2/hide] + #- [0x, asm, P2/hnd] + #- [0x, asm, P2/ik] + #- [0x, asm, P2/jack] + #- [0x, asm, P2/jlo] + - [0x6f0b8, asm, P2/joy] + - [0x70608, asm, P2/jt] + #- [0x, asm, P2/jp] + #- [0x, asm, P2/jsg] + - [0x7e248, asm, P2/jump] + #- [0x, asm, P2/keyhole] + #- [0x, asm, P2/landing] + #- [0x, asm, P2/lgn] + - [0x83c18, asm, P2/lo] + - [0x84cc8, asm, P2/light] + - [0x86358, asm, P2/lookat] + - [0x86758, asm, P2/main] + - [0x86c18, asm, P2/mark] + - [0x894c0, asm, P2/mat] - [0x8b388, asm] # TODO - #mecha - #mb - #memcard - #memory - #menu - #missile - #mouthgame - #mpeg - #mrkv - #ms - #murray + #- [0x, asm, P2/mecha] + #- [0x, asm, P2/mb] + #- [0x, asm, P2/memcard] + #- [0x, asm, P2/memory] + #- [0x, asm, P2/menu] + #- [0x, asm, P2/missile] + #- [0x, asm, P2/mouthgame] + #- [0x, asm, P2/mpeg] + #- [0x, asm, P2/mrkv] + #- [0x, asm, P2/ms] + #- [0x, asm, P2/murray] - - [0x917e0, c, P2/path] - - [0x92e70, c, P2/phasemem] - #pipe - - [0x93068, c, P2/pnt] - #po - - [0x94210, c, P2/prog] + - [0x917e0, asm, P2/path] + - [0x92e70, asm, P2/phasemem] + - [0x92ec0, asm, P2/pipe] + - [0x93068, asm, P2/pnt] + #- [0x, asm, P2/po] + - [0x94210, asm, P2/prog] - [0x94598, asm] # TODO - #prompt - #proxy - #puffer - #pzo - #rail - #rat - #rchm + #- [0x, asm, P2/prompt] + #- [0x, asm, P2/proxy] + #- [0x, asm, P2/puffer] + #- [0x, asm, P2/pzo] + #- [0x, asm, P2/rail] + #- [0x, asm, P2/rat] + #- [0x, asm, P2/rchm] - - [0x9e410, c, P2/render] - - [0x9f040, c, P2/rip] - #rog - #rope - - [0xa8b20, c, P2/rumble] - - [0xa8fe8, c, P2/rwm] - #sampler (might not be in release) - #sc - - [0xaac68, c, P2/screen] - #sensor - - [0xb2ac8, c, P2/shadow] - #shape - - [0xb3988, c, P2/shd] - - [0xb5920, c, P2/shdanim] - #sky - #slotheap - - [0xb6f50, c, P2/sm] - #smartguard - - [0xb8968, c, P2/so] - - [0xbd760, c, P2/solve] - - [0xbf068, c, P2/sort] - - [0xbf1e8, c, P2/sound] - #speaker - - [0xc2190, c, P2/splicemap] - - [0xc24c0, c, P2/spliceobj] - - [0xc3430, c, P2/sprbuf] - #sqtr - #squish - - [0xc5458, c, P2/step] - - [0xc6f18, c, P2/stepact] - - [0xc71e0, c, P2/stepcane] - #stepguard - #stephang - - [0xd24f0, c, P2/steppipe] - #stephide - - [0xd39c8, c, P2/steppower] - #steprun - - [0xd5148, c, P2/stepside] - #stepski - - [0xd5848, c, P2/stepzap] - - [0xd8120, c, P2/stream] - #suv - - [0xdc480, c, P2/sw] - #tail - #tank - #target - - [0xe18f8, c, P2/text] - #thread - #tn - - [0xe5e38, c, P2/transition] - - [0xe6378, c, P2/turret] - - [0xe6e70, c, P2/tv] - #ub - #ui - - [0xeac78, c, P2/update] + - [0x9e410, asm, P2/render] + - [0x9f040, asm, P2/rip] + #- [0x, asm, P2/rog] + #- [0x, asm, P2/rope] + - [0xa8b20, asm, P2/rumble] + - [0xa8fe8, asm, P2/rwm] + #- [0x, asm, P2/sampler] (might not be in release) + #- [0x, asm, P2/sc] + - [0xaac68, asm, P2/screen] + #- [0x, asm, P2/sensor] + - [0xb2ac8, asm, P2/shadow] + #- [0x, asm, P2/shape] + - [0xb3988, asm, P2/shd] + - [0xb5920, asm, P2/shdanim] + #- [0x, asm, P2/sky] + #- [0x, asm, P2/slotheap] + - [0xb6f50, asm, P2/sm] + #- [0x, asm, P2/smartguard] + - [0xb8968, asm, P2/so] + - [0xbd760, asm, P2/solve] + - [0xbf068, asm, P2/sort] + - [0xbf1e8, asm, P2/sound] + - [0xc1f30, asm, P2/speaker] + - [0xc2190, asm, P2/splicemap] + - [0xc24c0, asm, P2/spliceobj] + - [0xc3430, asm, P2/sprbuf] + #- [0x, asm, P2/sqtr] + #- [0x, asm, P2/squish] + - [0xc5458, asm, P2/step] + - [0xc6f18, asm, P2/stepact] + - [0xc71e0, asm, P2/stepcane] + - [0xc7f48, asm, P2/stepguard] + - [0xcd410, asm, P2/stephang] + - [0xcefb8, asm, P2/stephide] + - [0xd24f0, asm, P2/steppipe] + - [0xd39c8, asm, P2/steppower] + + - [0xd41d0, asm] #? unknown file + + - [0xd46f0, asm, P2/steprun] + - [0xd5148, asm, P2/stepside] + - [0xd5848, asm, P2/stepzap] + - [0xd8120, asm, P2/stream] + #- [0x, asm, P2/suv] + - [0xdc480, asm, P2/sw] + #- [0x, asm, P2/tail] + #- [0x, asm, P2/tank] + #- [0x, asm, P2/target] + - [0xe18f8, asm, P2/text] + #- [0x, asm, P2/thread] + #- [0x, asm, P2/tn] + - [0xe5e38, asm, P2/transition] + - [0xe6378, asm, P2/turret] + - [0xe6e70, asm, P2/tv] + #- [0x, asm, P2/ub] + #- [0x, asm, P2/ui] + - [0xeac78, asm, P2/update] - [0xeb408, c, P2/util] - - [0xec518, asm] # TODO what is this? + - [0xec518, asm] #? unknown file - - [0xee650, c, P2/vec] - #vife (not in release, or somewhere else) - - [0xef318, c, P2/vifs] - - [0xef900, c, P2/vis] - - [0xefc60, c, P2/water] - - [0xf0838, c, P2/waypoint] - - [0xf0ce8, c, P2/wipe] - - [0xf1758, c, P2/wm] # not confident - - [0xf49f8, c, P2/xform] - - [0xf5f70, c, P2/zap] + - [0xee650, asm, P2/vec] + - [0xef318, asm, P2/vifs] + - [0xef900, asm, P2/vis] + - [0xefc60, asm, P2/water] + - [0xf0838, asm, P2/waypoint] + - [0xf0ce8, asm, P2/wipe] + - [0xf1758, asm, P2/wm] # not confident + - [0xf49f8, asm, P2/xform] + - [0xf5f70, asm, P2/zap] - # Source files in May proto that aren't in release: - # P2/cycle.c - some kind of vehicle? + ## Source files in May proto that aren't in release: + # P2/cycle.c - some kind of wheeled vehicle # P2/hg.c - hang glider - # P2map2d.c - world map? + # P2/stepski.c - skiing + # P2/map2d.c - unknown + # P2/vife.c - vif encoder # P2/wibu_ee.c - wibukey encryption #---------------------------------------- @@ -263,8 +274,14 @@ segments: - [0x112E10, bin, vutext] + #---------------------------------------- + # Rodata + #---------------------------------------- - [0x118380, rodata] + #---------------------------------------- + # Data + #---------------------------------------- - [0x151580, data] - [0x17C200, databin] diff --git a/config/symbol_addrs.txt b/config/symbol_addrs.txt index cab196e7..7f36776e 100644 --- a/config/symbol_addrs.txt +++ b/config/symbol_addrs.txt @@ -926,7 +926,7 @@ EnsureAsegBlendDynamic = 0x139038; // type:func FillBlAmrsg = 0x139600; // type:func CalculateBlendAmrsg = 0x139740; // type:func FUN_00139970 = 0x139970; // type:func -FUN_001399f8 = 0x1399F8; // type:func +ReblendAsegbl = 0x1399F8; // type:func FUN_00139b38 = 0x139B38; // type:func BuildBlipAqwGifs = 0x139B70; // type:func StartupBlips = 0x139C38; // type:func @@ -974,7 +974,7 @@ LoadBrkFromBrx = 0x13CD80; // type:func CloneBrk = 0x13CDE8; // type:func FUN_0013ce40 = 0x13CE40; // type:func FUN_0013ce80 = 0x13CE80; // type:func -FUN_0013d068 = 0x13D068; // type:func +UpdateBrk = 0x13D068; // type:func FUN_0013d0b0 = 0x13D0B0; // type:func BreakBrk = 0x13D278; // type:func FUN_0013d820 = 0x13D820; // type:func @@ -988,7 +988,7 @@ FUN_0013ddb8 = 0x13DDB8; // type:func FUN_0013ddf0 = 0x13DDF0; // type:func FUN_0013de38 = 0x13DE38; // type:func FUN_0013dee8 = 0x13DEE8; // type:func -FUN_0013df68 = 0x13DF68; // type:func +UpdateZapbreak = 0x13DF68; // type:func FUN_0013dfd8 = 0x13DFD8; // type:func PruneBsp = 0x13E430; // type:func PbspPointInBspQuick = 0x13E658; // type:func @@ -1285,7 +1285,7 @@ FUN_0014ea48 = 0x14EA48; // type:func FUN_0014eb10 = 0x14EB10; // type:func FUN_0014ec70 = 0x14EC70; // type:func FindCrvcClosestPointFromS = 0x14ED98; // type:func -FUN_0014ee40 = 0x14EE40; // type:func +InitDart = 0x14EE40; // type:func FUN_0014ee70 = 0x14EE70; // type:func FUN_0014ef00 = 0x14EF00; // type:func FUN_0014ef40 = 0x14EF40; // type:func @@ -1460,7 +1460,7 @@ RemoveFader = 0x159C28; // type:func FUN_00159ca0 = 0x159CA0; // type:func FUN_00159d00 = 0x159D00; // type:func FUN_00159ed0 = 0x159ED0; // type:func -PdlFromSwOid__FP2SW3OID = 0x159F20; // type:func +PdlFromSwOid = 0x159F20; // type:func MatchSwObject = 0x159F48; // type:func CploFindSwObjects = 0x15A198; // type:func PloFindSwObject = 0x15A418; // type:func @@ -1874,7 +1874,7 @@ FUN_0017b998 = 0x17B998; // type:func FUN_0017b9d0 = 0x17B9D0; // type:func SetJsgFocus = 0x17BB78; // type:func FUN_0017bc20 = 0x17BC20; // type:func -FUN_0017bcd0 = 0x17BCD0; // type:func +NextJsgJsge = 0x17BCD0; // type:func FUN_0017c428 = 0x17C428; // type:func FUN_0017c660 = 0x17C660; // type:func FUN_0017c718 = 0x17C718; // type:func @@ -2033,10 +2033,10 @@ Startup = 0x185B38; // type:func MuFromAmtlk = 0x185C18; // type:func ElasFromAmtlk = 0x185CA0; // type:func PxpAdd = 0x185D20; // type:func -FUN_00185f48 = 0x185F48; // type:func -FUN_001860a8 = 0x1860A8; // type:func +RecalcSwXpPos = 0x185F48; // type:func +RecalcSwXpMovement = 0x1860A8; // type:func FreeSwXpList = 0x1861E8; // type:func -FUN_00186230 = 0x186230; // type:func +FindClosestPointOnLine = 0x186230; // type:func FUN_00186320 = 0x186320; // type:func ClsgClipSoAllEdges = 0x186450; // type:func ClsgClipSoBspEdges = 0x186568; // type:func @@ -2250,7 +2250,7 @@ FUN_00191ac8 = 0x191AC8; // type:func ChoosePathzoneRandomPoint = 0x191C78; // type:func SetPhase = 0x191E70; // type:func ClearPhase = 0x191EB0; // type:func -FUN_00191ec0 = 0x191EC0; // type:func +StartupPipe = 0x191EC0; // type:func ResetPipeList = 0x191EE8; // type:func FUN_00191f08 = 0x191F08; // type:func FUN_00191f68 = 0x191F68; // type:func @@ -3227,7 +3227,7 @@ FUN_001cdb28 = 0x1CDB28; // type:func FUN_001cdb70 = 0x1CDB70; // type:func FUN_001cdd98 = 0x1CDD98; // type:func FUN_001cdf78 = 0x1CDF78; // type:func -FUN_001cdfb8 = 0x1CDFB8; // type:func +JtbsChooseJtHide = 0x1CDFB8; // type:func MeasureJtJumpToTarget = 0x1CE590; // type:func GetJtRailLanding = 0x1CE800; // type:func FUN_001ce9e8 = 0x1CE9E8; // type:func @@ -3256,7 +3256,7 @@ FUN_001d27c0 = 0x1D27C0; // type:func PlaceJtOnPipe = 0x1D2830; // type:func SetFsp = 0x1D29C8; // type:func UpdateJtActivePowerUp = 0x1D2BB8; // type:func -FUN_001d3100 = 0x1D3100; // type:func +IRotatePowerUp = 0x1D3100; // type:func FUN_001d31d0 = 0x1D31D0; // type:func FUN_001d3290 = 0x1D3290; // type:func FUN_001d32d8 = 0x1D32D8; // type:func @@ -3266,16 +3266,16 @@ FUN_001d34e0 = 0x1D34E0; // type:func FUN_001d3500 = 0x1D3500; // type:func FUN_001d35a8 = 0x1D35A8; // type:func FUN_001d3678 = 0x1D3678; // type:func -FUN_001d36f0 = 0x1D36F0; // type:func +PostStepLoadRun = 0x1D36F0; // type:func CalculateBlrunV = 0x1D39E0; // type:func ProjectStepRunPlant = 0x1D3A38; // type:func FIntersectStepRunPlant = 0x1D3B58; // type:func FReblendAbl2D = 0x1D3C68; // type:func -FUN_001d3e00 = 0x1D3E00; // type:func -FUN_001d40a0 = 0x1D40A0; // type:func +AdjustStepRun = 0x1D3E00; // type:func +SetStepRunTarget = 0x1D40A0; // type:func PostJtLoadSidestep = 0x1D4148; // type:func AdjustJtSidestep = 0x1D4348; // type:func -FUN_001d4698 = 0x1D4698; // type:func +SetJtSidestepTarget = 0x1D4698; // type:func PostJtLoadZap = 0x1D4848; // type:func FUN_001d48e8 = 0x1D48E8; // type:func FUN_001d4a98 = 0x1D4A98; // type:func diff --git a/include/bif.h b/include/bif.h new file mode 100644 index 00000000..77927650 --- /dev/null +++ b/include/bif.h @@ -0,0 +1,16 @@ +/** + * @file bif.h +*/ +#ifndef BIF_H +#define BIF_H + +#include +#include + +struct VU_VECTOR +{ + // todo + //VU_VECTOR(VECTOR* vec); +}; + +#endif // BIF_H diff --git a/include/common.h b/include/common.h index a6838970..28f3a4d2 100644 --- a/include/common.h +++ b/include/common.h @@ -2,5 +2,6 @@ #define COMMON_H #include "include_asm.h" +#include -#endif /* COMMON_H */ \ No newline at end of file +#endif /* COMMON_H */ diff --git a/include/mat.h b/include/mat.h index 0dbfd037..bbf0b6b0 100644 --- a/include/mat.h +++ b/include/mat.h @@ -6,8 +6,6 @@ #ifndef MAT_H #define MAT_H -typedef struct MATRIX4 GRFDP; - /** * @brief 4x4 Matrix */ diff --git a/include/ref.h b/include/ref.h index 99041580..da169be1 100644 --- a/include/ref.h +++ b/include/ref.h @@ -5,6 +5,7 @@ */ #ifndef REF_H #define REF_H +#include /** * @brief Unknown, needs more research @@ -17,4 +18,19 @@ public: //todo }; +struct SMP +{ + undefined4 field_0x0; + float svSlow; + float dtFast; +}; + +struct SMPA +{ + float svFast; + float svSlow; + float dtFast; + float sdvMax; +}; + #endif // REF_H diff --git a/include/so.h b/include/so.h index b178680a..79ca99dd 100644 --- a/include/so.h +++ b/include/so.h @@ -6,7 +6,7 @@ #ifndef SO_H #define SO_H -#include +#include #include #include diff --git a/include/speaker.h b/include/speaker.h index a85a37b1..77e08ad8 100644 --- a/include/speaker.h +++ b/include/speaker.h @@ -49,14 +49,11 @@ struct SPEAKER */ struct DP { - GRFDP grfdp; + uint grfdp; DPK dpk; SPEAKER* pspeakerLeft; - byte field_0x9; - byte field_0xa; - byte field_0xb; SPEAKER* pspeakerRight; - struct ASEGA* pasegaLipsync; + ASEGA* pasegaLipsync; float tPauseMin; }; diff --git a/include/types.h b/include/types.h index 89a4f086..2cb9ff0d 100644 --- a/include/types.h +++ b/include/types.h @@ -12,8 +12,6 @@ typedef bool BOOL; typedef unsigned char BYTE; typedef unsigned char byte; -typedef unsigned int undefined4; - typedef unsigned long ulong; typedef unsigned int uint; @@ -30,4 +28,8 @@ typedef unsigned int uint32_t; typedef unsigned short uint16_t; typedef unsigned char uint8_t; +typedef unsigned short undefined2; +typedef unsigned int undefined4; +typedef unsigned long undefined8; + #endif // TYPES_H diff --git a/include/util.h b/include/util.h index 24936acd..97d834a1 100644 --- a/include/util.h +++ b/include/util.h @@ -6,7 +6,10 @@ #ifndef UTIL_H #define UTIL_H -#include +#include +#include +#include +#include /** * @brief Limits for a float @@ -38,12 +41,12 @@ float RadNormalize(float rad); */ float GLimitAbs(float g, float absLimit); -//float GSmooth(float gCur, float gTarget, float dt, SMP* psmp, float* pdgNext); -//float GSmoothA(float gCur, float dgCur, float gTarget, float dt, SMPA* psmpa, float* pdgNext); -//float RadSmooth(float radCur, float radTarget, float dt, SMP* psmp, float* pdradNext); -//float RadSmoothA(float radCur, float dradCur, float radTarget, float dt, SMPA* psmpa, float* pdradNext); -//void SmoothMatrix(MAT* pmatPrev, MAT* pmatNext, SMP* psmp, float dt, MAT* pmatSmooth, VECTOR* pwSmooth); -//VU_VECTOR PosSmooth(VU_VECTOR posCur, VU_VECTOR posTarget, float dt, SMP* psmp, VECTOR* pv); +float GSmooth(float gCur, float gTarget, float dt, SMP* psmp, float* pdgNext); +float GSmoothA(float gCur, float dgCur, float gTarget, float dt, SMPA* psmpa, float* pdgNext); +float RadSmooth(float radCur, float radTarget, float dt, SMP* psmp, float* pdradNext); +float RadSmoothA(float radCur, float dradCur, float radTarget, float dt, SMPA* psmpa, float* pdradNext); +VU_VECTOR PosSmooth(VU_VECTOR posCur, VU_VECTOR posTarget, float dt, SMP* psmp, VECTOR* pv); +void SmoothMatrix(MATRIX3* pmatPrev, MATRIX3* pmatNext, SMP* psmp, float dt, MATRIX3* pmatSmooth, VECTOR* pwSmooth); /** * @brief Gets a random int that falls between the given values. @@ -92,7 +95,7 @@ BOOL FFloatsNear(float g1, float g2, float gEpsilon); * @brief Solves a quadratic equation. * * A quadratic equation is of the form ax^2 + bx + c = 0. The solutions (if any) - * are stored in the given array. + * are stored in ax[0] and ax[1]. * * @param a The coefficient of the x^2 term * @param b The coefficient of the x term @@ -103,7 +106,7 @@ BOOL FFloatsNear(float g1, float g2, float gEpsilon); */ int CSolveQuadratic(float a, float b, float c, float* ax); -//void PrescaleClq(CLQ* pclqSrc, float ru, float du, CLQ* pclqDst); +void PrescaleClq(CLQ* pclqSrc, float ru, float du, CLQ* pclqDst); /** * @brief Calculates the sine and cosine of a given angle. @@ -142,7 +145,7 @@ float GTrunc(float g); */ float GModPositive(float gDividend, float gDivisor); -//void FitClq(float g0, float g1, float u, float gU, CLQ* pclq); +void FitClq(float g0, float g1, float u, float gU, CLQ* pclq); /** * @brief Checks if a float falls within the given limit. @@ -188,7 +191,7 @@ int SgnCompareG(float* pg1, float* pg2); */ void Force(void* pv); -//void MinimizeRange(PFNGG pfn, void* pv, float g, float dg, float gMin, float gMax, float* pgDom, float* pgRng); +void MinimizeRange(void* pfn, void* pv, float g, float dg, float gMin, float gMax, float* pgDom, float* pgRng); //int CSolveClq(CLQ* pclq, float g, float* ag); //float DtSmooth(float gCur, float gTarget, SMP* psmp, float* pdg); diff --git a/include/vec.h b/include/vec.h index 966279f6..82629689 100644 --- a/include/vec.h +++ b/include/vec.h @@ -6,7 +6,6 @@ #ifndef VEC_H #define VEC_H -#include #include typedef int GRFPVA; diff --git a/requirements.txt b/requirements.txt index 780dc1ab..153ffab0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,7 @@ spimdisasm>=1.18.0 rabbitizer>=1.8.0 splat64>=0.23.0 -tqdm \ No newline at end of file +tqdm +n64img +pygfxd +crunch64 diff --git a/src/P2/util.c b/src/P2/util.c index f4b50da5..86dd2750 100644 --- a/src/P2/util.c +++ b/src/P2/util.c @@ -33,6 +33,19 @@ float GLimitAbs(float g, float absLimit) return g; } +INCLUDE_ASM(const s32, "P2/util", GSmooth); + +INCLUDE_ASM(const s32, "P2/util", GSmoothA); +INCLUDE_ASM(const s32, "P2/util", func_001EA720); // Part of GSmoothA + +INCLUDE_ASM(const s32, "P2/util", RadSmooth); + +INCLUDE_ASM(const s32, "P2/util", RadSmoothA); + +INCLUDE_ASM(const s32, "P2/util", PosSmooth); + +INCLUDE_ASM(const s32, "P2/util", SmoothMatrix); + int NRandInRange(int nLow, int nHigh) { if (nLow != nHigh) @@ -87,11 +100,6 @@ BOOL FFloatsNear(float g1, float g2, float gEpsilon) return (BOOL)(unsigned int)(fabs(g1 - g2) / (float)((unsigned int)(g1Abs < 1.0) * 0x3f800000 | (int)g1Abs * (unsigned int)(g1Abs >= 1.0)) < gEpsilon); } -/* - * Solves a quadratic equation of the form ax^2 + bx + c = 0 - * Returns the number of solutions found (0, 1, or 2) - * If there are two solutions, they are returned in ax[0] and ax[1] -*/ int CSolveQuadratic(float a, float b, float c, float* ax) { float rad = (b * b) - 4.0 * a * c; @@ -113,7 +121,7 @@ int CSolveQuadratic(float a, float b, float c, float* ax) return 2; // two solutions: (-b � radical) / 2a } -//TODO: PrescaleClq +INCLUDE_ASM(const s32, "P2/util", PrescaleClq); void CalculateSinCos(float angle, float *sin, float *cos) { @@ -207,7 +215,7 @@ float GModPositive(float gDividend, float gDivisor) return result; } -//TODO: FitClq +INCLUDE_ASM(const s32, "P2/util", FitClq); /** * @note Matching 100% @@ -265,3 +273,6 @@ void Force(void *) { // This function is empty. } + +INCLUDE_ASM(const s32, "P2/util", MinimizeRange); +INCLUDE_ASM(const s32, "P2/util", func_001EB458);