diff --git a/Makefile b/Makefile index e08d983c8..df9ceaa04 100644 --- a/Makefile +++ b/Makefile @@ -173,14 +173,12 @@ SRC_DIRS := $(shell find src -type d) ASM_DIRS := $(shell find asm -type d -not -path "asm/non_matchings*") $(shell find data -type d) ## Assets binaries (PNGs, JPGs, etc) -ASSET_BIN_DIRS := $(shell find assets/* -type d -not -path "assets/xml*") +ASSET_BIN_DIRS := $(shell find assets/* -type d -not -path "assets/xml*" -not -path "assets/c/*" -not -name "c") # Prevents building C files that will be #include'd ASSET_BIN_DIRS_C_FILES := $(shell find assets/* -type d -not -path "assets/xml*" -not -path "assets/code*" -not -path "assets/overlays*") -ASSET_FILES_XML := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.xml)) ASSET_FILES_BIN := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.bin)) -ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_XML:.xml=.c),$f) \ - $(foreach f,$(ASSET_FILES_BIN:.bin=.bin.inc.c),build/$f) +ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_BIN:.bin=.bin.inc.c),build/$f) TEXTURE_FILES_PNG := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.png)) TEXTURE_FILES_JPG := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.jpg)) @@ -204,7 +202,7 @@ OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | grep -o '[^"]*_reloc.o' DEP_FILES := $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d) # create build directories -$(shell mkdir -p build/baserom $(foreach dir,$(SRC_DIRS) $(ASM_DIRS) $(ASSET_BIN_DIRS),build/$(dir))) +$(shell mkdir -p build/baserom $(foreach dir,$(SRC_DIRS) $(ASM_DIRS) $(ASSET_BIN_DIRS) $(ASSET_BIN_DIRS_C_FILES),build/$(dir))) # directory flags build/src/boot/O2/%.o: OPTFLAGS := -O2 @@ -353,7 +351,7 @@ build/assets/%.o: assets/%.c $(OBJCOPY_BIN) $(RM_MDEBUG) -build/assets/archives/%.yar.o: build/assets/archives/%.o +build/%.yar.o: build/%.o $(MAKEYAR) $< $(@:.yar.o=.yar.bin) $(@:.yar.o=.symbols.o) $(OBJCOPY) -I binary -O elf32-big $(@:.yar.o=.yar.bin) $@ diff --git a/assets/c/.gitignore b/assets/c/.gitignore new file mode 100644 index 000000000..66dbd2b82 --- /dev/null +++ b/assets/c/.gitignore @@ -0,0 +1,2 @@ +!*.c +!*.h diff --git a/assets/c/archives/map_grand_static/map_grand_static.c b/assets/c/archives/map_grand_static/map_grand_static.c new file mode 100644 index 000000000..582d37e68 --- /dev/null +++ b/assets/c/archives/map_grand_static/map_grand_static.c @@ -0,0 +1,394 @@ +#include "map_grand_static.h" + +u64 gMapGrandStatic100Tex[] = { +#include "assets/archives/map_grand_static/map_100.i4.inc.c" +}; + +u64 gMapGrandStatic101Tex[] = { +#include "assets/archives/map_grand_static/map_101.i4.inc.c" +}; + +u64 gMapGrandStatic102Tex[] = { +#include "assets/archives/map_grand_static/map_102.i4.inc.c" +}; + +u64 gMapGrandStatic103Tex[] = { +#include "assets/archives/map_grand_static/map_103.i4.inc.c" +}; + +u64 gMapGrandStatic104Tex[] = { +#include "assets/archives/map_grand_static/map_104.i4.inc.c" +}; + +u64 gMapGrandStatic105Tex[] = { +#include "assets/archives/map_grand_static/map_105.i4.inc.c" +}; + +u64 gMapGrandStatic106Tex[] = { +#include "assets/archives/map_grand_static/map_106.i4.inc.c" +}; + +u64 gMapGrandStatic107Tex[] = { +#include "assets/archives/map_grand_static/map_107.i4.inc.c" +}; + +u64 gMapGrandStatic108Tex[] = { +#include "assets/archives/map_grand_static/map_108.i4.inc.c" +}; + +u64 gMapGrandStatic109Tex[] = { +#include "assets/archives/map_grand_static/map_109.i4.inc.c" +}; + +u64 gMapGrandStatic10ATex[] = { +#include "assets/archives/map_grand_static/map_10A.i4.inc.c" +}; + +u64 gMapGrandStatic10BTex[] = { +#include "assets/archives/map_grand_static/map_10B.i4.inc.c" +}; + +u64 gMapGrandStatic10CTex[] = { +#include "assets/archives/map_grand_static/map_10C.i4.inc.c" +}; + +u64 gMapGrandStatic10DTex[] = { +#include "assets/archives/map_grand_static/map_10D.i4.inc.c" +}; + +u64 gMapGrandStatic10ETex[] = { +#include "assets/archives/map_grand_static/map_10E.i4.inc.c" +}; + +u64 gMapGrandStatic10FTex[] = { +#include "assets/archives/map_grand_static/map_10F.i4.inc.c" +}; + +u64 gMapGrandStatic110Tex[] = { +#include "assets/archives/map_grand_static/map_110.i4.inc.c" +}; + +u64 gMapGrandStatic111Tex[] = { +#include "assets/archives/map_grand_static/map_111.i4.inc.c" +}; + +u64 gMapGrandStatic112Tex[] = { +#include "assets/archives/map_grand_static/map_112.i4.inc.c" +}; + +u64 gMapGrandStatic113Tex[] = { +#include "assets/archives/map_grand_static/map_113.i4.inc.c" +}; + +u64 gMapGrandStatic114Tex[] = { +#include "assets/archives/map_grand_static/map_114.i4.inc.c" +}; + +u64 gMapGrandStatic115Tex[] = { +#include "assets/archives/map_grand_static/map_115.i4.inc.c" +}; + +u64 gMapGrandStatic116Tex[] = { +#include "assets/archives/map_grand_static/map_116.i4.inc.c" +}; + +u64 gMapGrandStatic117Tex[] = { +#include "assets/archives/map_grand_static/map_117.i4.inc.c" +}; + +u64 gMapGrandStatic118Tex[] = { +#include "assets/archives/map_grand_static/map_118.i4.inc.c" +}; + +u64 gMapGrandStatic119Tex[] = { +#include "assets/archives/map_grand_static/map_119.i4.inc.c" +}; + +u64 gMapGrandStatic11ATex[] = { +#include "assets/archives/map_grand_static/map_11A.i4.inc.c" +}; + +u64 gMapGrandStatic11BTex[] = { +#include "assets/archives/map_grand_static/map_11B.i4.inc.c" +}; + +u64 gMapGrandStatic11CTex[] = { +#include "assets/archives/map_grand_static/map_11C.i4.inc.c" +}; + +u64 gMapGrandStatic11DTex[] = { +#include "assets/archives/map_grand_static/map_11D.i4.inc.c" +}; + +u64 gMapGrandStatic11ETex[] = { +#include "assets/archives/map_grand_static/map_11E.i4.inc.c" +}; + +u64 gMapGrandStatic11FTex[] = { +#include "assets/archives/map_grand_static/map_11F.i4.inc.c" +}; + +u64 gMapGrandStatic120Tex[] = { +#include "assets/archives/map_grand_static/map_120.i4.inc.c" +}; + +u64 gMapGrandStatic121Tex[] = { +#include "assets/archives/map_grand_static/map_121.i4.inc.c" +}; + +u64 gMapGrandStatic122Tex[] = { +#include "assets/archives/map_grand_static/map_122.i4.inc.c" +}; + +u64 gMapGrandStatic123Tex[] = { +#include "assets/archives/map_grand_static/map_123.i4.inc.c" +}; + +u64 gMapGrandStatic124Tex[] = { +#include "assets/archives/map_grand_static/map_124.i4.inc.c" +}; + +u64 gMapGrandStatic125Tex[] = { +#include "assets/archives/map_grand_static/map_125.i4.inc.c" +}; + +u64 gMapGrandStatic126Tex[] = { +#include "assets/archives/map_grand_static/map_126.i4.inc.c" +}; + +u64 gMapGrandStatic127Tex[] = { +#include "assets/archives/map_grand_static/map_127.i4.inc.c" +}; + +u64 gMapGrandStatic128Tex[] = { +#include "assets/archives/map_grand_static/map_128.i4.inc.c" +}; + +u64 gMapGrandStatic129Tex[] = { +#include "assets/archives/map_grand_static/map_129.i4.inc.c" +}; + +u64 gMapGrandStatic12ATex[] = { +#include "assets/archives/map_grand_static/map_12A.i4.inc.c" +}; + +u64 gMapGrandStatic12BTex[] = { +#include "assets/archives/map_grand_static/map_12B.i4.inc.c" +}; + +u64 gMapGrandStatic12CTex[] = { +#include "assets/archives/map_grand_static/map_12C.i4.inc.c" +}; + +u64 gMapGrandStatic12DTex[] = { +#include "assets/archives/map_grand_static/map_12D.i4.inc.c" +}; + +u64 gMapGrandStatic12ETex[] = { +#include "assets/archives/map_grand_static/map_12E.i4.inc.c" +}; + +u64 gMapGrandStatic12FTex[] = { +#include "assets/archives/map_grand_static/map_12F.i4.inc.c" +}; + +u64 gMapGrandStatic130Tex[] = { +#include "assets/archives/map_grand_static/map_130.i4.inc.c" +}; + +u64 gMapGrandStatic131Tex[] = { +#include "assets/archives/map_grand_static/map_131.i4.inc.c" +}; + +u64 gMapGrandStatic132Tex[] = { +#include "assets/archives/map_grand_static/map_132.i4.inc.c" +}; + +u64 gMapGrandStatic133Tex[] = { +#include "assets/archives/map_grand_static/map_133.i4.inc.c" +}; + +u64 gMapGrandStatic134Tex[] = { +#include "assets/archives/map_grand_static/map_134.i4.inc.c" +}; + +u64 gMapGrandStatic135Tex[] = { +#include "assets/archives/map_grand_static/map_135.i4.inc.c" +}; + +u64 gMapGrandStatic136Tex[] = { +#include "assets/archives/map_grand_static/map_136.i4.inc.c" +}; + +u64 gMapGrandStatic137Tex[] = { +#include "assets/archives/map_grand_static/map_137.i4.inc.c" +}; + +u64 gMapGrandStatic138Tex[] = { +#include "assets/archives/map_grand_static/map_138.i4.inc.c" +}; + +u64 gMapGrandStatic139Tex[] = { +#include "assets/archives/map_grand_static/map_139.i4.inc.c" +}; + +u64 gMapGrandStatic13ATex[] = { +#include "assets/archives/map_grand_static/map_13A.i4.inc.c" +}; + +u64 gMapGrandStatic13BTex[] = { +#include "assets/archives/map_grand_static/map_13B.i4.inc.c" +}; + +u64 gMapGrandStatic13CTex[] = { +#include "assets/archives/map_grand_static/map_13C.i4.inc.c" +}; + +u64 gMapGrandStatic13DTex[] = { +#include "assets/archives/map_grand_static/map_13D.i4.inc.c" +}; + +u64 gMapGrandStatic13ETex[] = { +#include "assets/archives/map_grand_static/map_13E.i4.inc.c" +}; + +u64 gMapGrandStatic13FTex[] = { +#include "assets/archives/map_grand_static/map_13F.i4.inc.c" +}; + +u64 gMapGrandStatic140Tex[] = { +#include "assets/archives/map_grand_static/map_140.i4.inc.c" +}; + +u64 gMapGrandStatic141Tex[] = { +#include "assets/archives/map_grand_static/map_141.i4.inc.c" +}; + +u64 gMapGrandStatic142Tex[] = { +#include "assets/archives/map_grand_static/map_142.i4.inc.c" +}; + +u64 gMapGrandStatic143Tex[] = { +#include "assets/archives/map_grand_static/map_143.i4.inc.c" +}; + +u64 gMapGrandStatic144Tex[] = { +#include "assets/archives/map_grand_static/map_144.i4.inc.c" +}; + +u64 gMapGrandStatic145Tex[] = { +#include "assets/archives/map_grand_static/map_145.i4.inc.c" +}; + +u64 gMapGrandStatic146Tex[] = { +#include "assets/archives/map_grand_static/map_146.i4.inc.c" +}; + +u64 gMapGrandStatic147Tex[] = { +#include "assets/archives/map_grand_static/map_147.i4.inc.c" +}; + +u64 gMapGrandStatic148Tex[] = { +#include "assets/archives/map_grand_static/map_148.i4.inc.c" +}; + +u64 gMapGrandStatic149Tex[] = { +#include "assets/archives/map_grand_static/map_149.i4.inc.c" +}; + +u64 gMapGrandStatic14ATex[] = { +#include "assets/archives/map_grand_static/map_14A.i4.inc.c" +}; + +u64 gMapGrandStatic14BTex[] = { +#include "assets/archives/map_grand_static/map_14B.i4.inc.c" +}; + +u64 gMapGrandStatic14CTex[] = { +#include "assets/archives/map_grand_static/map_14C.i4.inc.c" +}; + +u64 gMapGrandStatic14DTex[] = { +#include "assets/archives/map_grand_static/map_14D.i4.inc.c" +}; + +u64 gMapGrandStatic14ETex[] = { +#include "assets/archives/map_grand_static/map_14E.i4.inc.c" +}; + +u64 gMapGrandStatic14FTex[] = { +#include "assets/archives/map_grand_static/map_14F.i4.inc.c" +}; + +u64 gMapGrandStatic150Tex[] = { +#include "assets/archives/map_grand_static/map_150.i4.inc.c" +}; + +u64 gMapGrandStatic151Tex[] = { +#include "assets/archives/map_grand_static/map_151.i4.inc.c" +}; + +u64 gMapGrandStatic152Tex[] = { +#include "assets/archives/map_grand_static/map_152.i4.inc.c" +}; + +u64 gMapGrandStatic153Tex[] = { +#include "assets/archives/map_grand_static/map_153.i4.inc.c" +}; + +u64 gMapGrandStatic154Tex[] = { +#include "assets/archives/map_grand_static/map_154.i4.inc.c" +}; + +u64 gMapGrandStatic155Tex[] = { +#include "assets/archives/map_grand_static/map_155.i4.inc.c" +}; + +u64 gMapGrandStatic156Tex[] = { +#include "assets/archives/map_grand_static/map_156.i4.inc.c" +}; + +u64 gMapGrandStatic157Tex[] = { +#include "assets/archives/map_grand_static/map_157.i4.inc.c" +}; + +u64 gMapGrandStatic158Tex[] = { +#include "assets/archives/map_grand_static/map_158.i4.inc.c" +}; + +u64 gMapGrandStatic159Tex[] = { +#include "assets/archives/map_grand_static/map_159.i4.inc.c" +}; + +u64 gMapGrandStatic15ATex[] = { +#include "assets/archives/map_grand_static/map_15A.i4.inc.c" +}; + +u64 gMapGrandStatic15BTex[] = { +#include "assets/archives/map_grand_static/map_15B.i4.inc.c" +}; + +u64 gMapGrandStatic15CTex[] = { +#include "assets/archives/map_grand_static/map_15C.i4.inc.c" +}; + +u64 gMapGrandStatic15DTex[] = { +#include "assets/archives/map_grand_static/map_15D.i4.inc.c" +}; + +u64 gMapGrandStatic15ETex[] = { +#include "assets/archives/map_grand_static/map_15E.i4.inc.c" +}; + +u64 gMapGrandStatic15FTex[] = { +#include "assets/archives/map_grand_static/map_15F.i4.inc.c" +}; + +u64 gMapGrandStatic160Tex[] = { +#include "assets/archives/map_grand_static/map_160.i4.inc.c" +}; + +u64 gMapGrandStatic161Tex[] = { +#include "assets/archives/map_grand_static/map_161.i4.inc.c" +}; + diff --git a/assets/c/archives/map_grand_static/map_grand_static.h b/assets/c/archives/map_grand_static/map_grand_static.h new file mode 100644 index 000000000..a940d4d42 --- /dev/null +++ b/assets/c/archives/map_grand_static/map_grand_static.h @@ -0,0 +1,105 @@ +#ifndef MAP_GRAND_STATIC_H +#define MAP_GRAND_STATIC_H 1 + +#include "ultra64.h" + +extern u64 gMapGrandStatic100Tex[]; +extern u64 gMapGrandStatic101Tex[]; +extern u64 gMapGrandStatic102Tex[]; +extern u64 gMapGrandStatic103Tex[]; +extern u64 gMapGrandStatic104Tex[]; +extern u64 gMapGrandStatic105Tex[]; +extern u64 gMapGrandStatic106Tex[]; +extern u64 gMapGrandStatic107Tex[]; +extern u64 gMapGrandStatic108Tex[]; +extern u64 gMapGrandStatic109Tex[]; +extern u64 gMapGrandStatic10ATex[]; +extern u64 gMapGrandStatic10BTex[]; +extern u64 gMapGrandStatic10CTex[]; +extern u64 gMapGrandStatic10DTex[]; +extern u64 gMapGrandStatic10ETex[]; +extern u64 gMapGrandStatic10FTex[]; +extern u64 gMapGrandStatic110Tex[]; +extern u64 gMapGrandStatic111Tex[]; +extern u64 gMapGrandStatic112Tex[]; +extern u64 gMapGrandStatic113Tex[]; +extern u64 gMapGrandStatic114Tex[]; +extern u64 gMapGrandStatic115Tex[]; +extern u64 gMapGrandStatic116Tex[]; +extern u64 gMapGrandStatic117Tex[]; +extern u64 gMapGrandStatic118Tex[]; +extern u64 gMapGrandStatic119Tex[]; +extern u64 gMapGrandStatic11ATex[]; +extern u64 gMapGrandStatic11BTex[]; +extern u64 gMapGrandStatic11CTex[]; +extern u64 gMapGrandStatic11DTex[]; +extern u64 gMapGrandStatic11ETex[]; +extern u64 gMapGrandStatic11FTex[]; +extern u64 gMapGrandStatic120Tex[]; +extern u64 gMapGrandStatic121Tex[]; +extern u64 gMapGrandStatic122Tex[]; +extern u64 gMapGrandStatic123Tex[]; +extern u64 gMapGrandStatic124Tex[]; +extern u64 gMapGrandStatic125Tex[]; +extern u64 gMapGrandStatic126Tex[]; +extern u64 gMapGrandStatic127Tex[]; +extern u64 gMapGrandStatic128Tex[]; +extern u64 gMapGrandStatic129Tex[]; +extern u64 gMapGrandStatic12ATex[]; +extern u64 gMapGrandStatic12BTex[]; +extern u64 gMapGrandStatic12CTex[]; +extern u64 gMapGrandStatic12DTex[]; +extern u64 gMapGrandStatic12ETex[]; +extern u64 gMapGrandStatic12FTex[]; +extern u64 gMapGrandStatic130Tex[]; +extern u64 gMapGrandStatic131Tex[]; +extern u64 gMapGrandStatic132Tex[]; +extern u64 gMapGrandStatic133Tex[]; +extern u64 gMapGrandStatic134Tex[]; +extern u64 gMapGrandStatic135Tex[]; +extern u64 gMapGrandStatic136Tex[]; +extern u64 gMapGrandStatic137Tex[]; +extern u64 gMapGrandStatic138Tex[]; +extern u64 gMapGrandStatic139Tex[]; +extern u64 gMapGrandStatic13ATex[]; +extern u64 gMapGrandStatic13BTex[]; +extern u64 gMapGrandStatic13CTex[]; +extern u64 gMapGrandStatic13DTex[]; +extern u64 gMapGrandStatic13ETex[]; +extern u64 gMapGrandStatic13FTex[]; +extern u64 gMapGrandStatic140Tex[]; +extern u64 gMapGrandStatic141Tex[]; +extern u64 gMapGrandStatic142Tex[]; +extern u64 gMapGrandStatic143Tex[]; +extern u64 gMapGrandStatic144Tex[]; +extern u64 gMapGrandStatic145Tex[]; +extern u64 gMapGrandStatic146Tex[]; +extern u64 gMapGrandStatic147Tex[]; +extern u64 gMapGrandStatic148Tex[]; +extern u64 gMapGrandStatic149Tex[]; +extern u64 gMapGrandStatic14ATex[]; +extern u64 gMapGrandStatic14BTex[]; +extern u64 gMapGrandStatic14CTex[]; +extern u64 gMapGrandStatic14DTex[]; +extern u64 gMapGrandStatic14ETex[]; +extern u64 gMapGrandStatic14FTex[]; +extern u64 gMapGrandStatic150Tex[]; +extern u64 gMapGrandStatic151Tex[]; +extern u64 gMapGrandStatic152Tex[]; +extern u64 gMapGrandStatic153Tex[]; +extern u64 gMapGrandStatic154Tex[]; +extern u64 gMapGrandStatic155Tex[]; +extern u64 gMapGrandStatic156Tex[]; +extern u64 gMapGrandStatic157Tex[]; +extern u64 gMapGrandStatic158Tex[]; +extern u64 gMapGrandStatic159Tex[]; +extern u64 gMapGrandStatic15ATex[]; +extern u64 gMapGrandStatic15BTex[]; +extern u64 gMapGrandStatic15CTex[]; +extern u64 gMapGrandStatic15DTex[]; +extern u64 gMapGrandStatic15ETex[]; +extern u64 gMapGrandStatic15FTex[]; +extern u64 gMapGrandStatic160Tex[]; +extern u64 gMapGrandStatic161Tex[]; + +#endif diff --git a/assets/c/archives/map_i_static/map_i_static.c b/assets/c/archives/map_i_static/map_i_static.c new file mode 100644 index 000000000..7b9432786 --- /dev/null +++ b/assets/c/archives/map_i_static/map_i_static.c @@ -0,0 +1,233 @@ +#include "map_i_static.h" + +u64 gMapIStatic00Tex[] = { +#include "assets/archives/map_i_static/map_00.i4.inc.c" +}; + +u64 gMapIStatic01Tex[] = { +#include "assets/archives/map_i_static/map_01.i4.inc.c" +}; + +u64 gMapIStatic02Tex[] = { +#include "assets/archives/map_i_static/map_02.i4.inc.c" +}; + +u64 gMapIStatic03Tex[] = { +#include "assets/archives/map_i_static/map_03.i4.inc.c" +}; + +u64 gMapIStatic04Tex[] = { +#include "assets/archives/map_i_static/map_04.i4.inc.c" +}; + +u64 gMapIStatic05Tex[] = { +#include "assets/archives/map_i_static/map_05.i4.inc.c" +}; + +u64 gMapIStatic06Tex[] = { +#include "assets/archives/map_i_static/map_06.i4.inc.c" +}; + +u64 gMapIStatic07Tex[] = { +#include "assets/archives/map_i_static/map_07.i4.inc.c" +}; + +u64 gMapIStatic08Tex[] = { +#include "assets/archives/map_i_static/map_08.i4.inc.c" +}; + +u64 gMapIStatic09Tex[] = { +#include "assets/archives/map_i_static/map_09.i4.inc.c" +}; + +u64 gMapIStatic0ATex[] = { +#include "assets/archives/map_i_static/map_0A.i4.inc.c" +}; + +u64 gMapIStatic0BTex[] = { +#include "assets/archives/map_i_static/map_0B.i4.inc.c" +}; + +u64 gMapIStatic0CTex[] = { +#include "assets/archives/map_i_static/map_0C.i4.inc.c" +}; + +u64 gMapIStatic0DTex[] = { +#include "assets/archives/map_i_static/map_0D.i4.inc.c" +}; + +u64 gMapIStatic0ETex[] = { +#include "assets/archives/map_i_static/map_0E.i4.inc.c" +}; + +u64 gMapIStatic0FTex[] = { +#include "assets/archives/map_i_static/map_0F.i4.inc.c" +}; + +u64 gMapIStatic10Tex[] = { +#include "assets/archives/map_i_static/map_10.i4.inc.c" +}; + +u64 gMapIStatic11Tex[] = { +#include "assets/archives/map_i_static/map_11.i4.inc.c" +}; + +u64 gMapIStatic12Tex[] = { +#include "assets/archives/map_i_static/map_12.i4.inc.c" +}; + +u64 gMapIStatic13Tex[] = { +#include "assets/archives/map_i_static/map_13.i4.inc.c" +}; + +u64 gMapIStatic14Tex[] = { +#include "assets/archives/map_i_static/map_14.i4.inc.c" +}; + +u64 gMapIStatic15Tex[] = { +#include "assets/archives/map_i_static/map_15.i4.inc.c" +}; + +u64 gMapIStatic16Tex[] = { +#include "assets/archives/map_i_static/map_16.i4.inc.c" +}; + +u64 gMapIStatic17Tex[] = { +#include "assets/archives/map_i_static/map_17.i4.inc.c" +}; + +u64 gMapIStatic18Tex[] = { +#include "assets/archives/map_i_static/map_18.i4.inc.c" +}; + +u64 gMapIStatic19Tex[] = { +#include "assets/archives/map_i_static/map_19.i4.inc.c" +}; + +u64 gMapIStatic1ATex[] = { +#include "assets/archives/map_i_static/map_1A.i4.inc.c" +}; + +u64 gMapIStatic1BTex[] = { +#include "assets/archives/map_i_static/map_1B.i4.inc.c" +}; + +u64 gMapIStatic1CTex[] = { +#include "assets/archives/map_i_static/map_1C.i4.inc.c" +}; + +u64 gMapIStatic1DTex[] = { +#include "assets/archives/map_i_static/map_1D.i4.inc.c" +}; + +u64 gMapIStatic1ETex[] = { +#include "assets/archives/map_i_static/map_1E.i4.inc.c" +}; + +u64 gMapIStatic1FTex[] = { +#include "assets/archives/map_i_static/map_1F.i4.inc.c" +}; + +u64 gMapIStatic20Tex[] = { +#include "assets/archives/map_i_static/map_20.i4.inc.c" +}; + +u64 gMapIStatic21Tex[] = { +#include "assets/archives/map_i_static/map_21.i4.inc.c" +}; + +u64 gMapIStatic22Tex[] = { +#include "assets/archives/map_i_static/map_22.i4.inc.c" +}; + +u64 gMapIStatic23Tex[] = { +#include "assets/archives/map_i_static/map_23.i4.inc.c" +}; + +u64 gMapIStatic24Tex[] = { +#include "assets/archives/map_i_static/map_24.i4.inc.c" +}; + +u64 gMapIStatic25Tex[] = { +#include "assets/archives/map_i_static/map_25.i4.inc.c" +}; + +u64 gMapIStatic26Tex[] = { +#include "assets/archives/map_i_static/map_26.i4.inc.c" +}; + +u64 gMapIStatic27Tex[] = { +#include "assets/archives/map_i_static/map_27.i4.inc.c" +}; + +u64 gMapIStatic28Tex[] = { +#include "assets/archives/map_i_static/map_28.i4.inc.c" +}; + +u64 gMapIStatic29Tex[] = { +#include "assets/archives/map_i_static/map_29.i4.inc.c" +}; + +u64 gMapIStatic2ATex[] = { +#include "assets/archives/map_i_static/map_2A.i4.inc.c" +}; + +u64 gMapIStatic2BTex[] = { +#include "assets/archives/map_i_static/map_2B.i4.inc.c" +}; + +u64 gMapIStatic2CTex[] = { +#include "assets/archives/map_i_static/map_2C.i4.inc.c" +}; + +u64 gMapIStatic2DTex[] = { +#include "assets/archives/map_i_static/map_2D.i4.inc.c" +}; + +u64 gMapIStatic2ETex[] = { +#include "assets/archives/map_i_static/map_2E.i4.inc.c" +}; + +u64 gMapIStatic2FTex[] = { +#include "assets/archives/map_i_static/map_2F.i4.inc.c" +}; + +u64 gMapIStatic30Tex[] = { +#include "assets/archives/map_i_static/map_30.i4.inc.c" +}; + +u64 gMapIStatic31Tex[] = { +#include "assets/archives/map_i_static/map_31.i4.inc.c" +}; + +u64 gMapIStatic32Tex[] = { +#include "assets/archives/map_i_static/map_32.i4.inc.c" +}; + +u64 gMapIStatic33Tex[] = { +#include "assets/archives/map_i_static/map_33.i4.inc.c" +}; + +u64 gMapIStatic34Tex[] = { +#include "assets/archives/map_i_static/map_34.i4.inc.c" +}; + +u64 gMapIStatic35Tex[] = { +#include "assets/archives/map_i_static/map_35.i4.inc.c" +}; + +u64 gMapIStatic36Tex[] = { +#include "assets/archives/map_i_static/map_36.i4.inc.c" +}; + +u64 gMapIStatic37Tex[] = { +#include "assets/archives/map_i_static/map_37.i4.inc.c" +}; + +u64 gMapIStatic38Tex[] = { +#include "assets/archives/map_i_static/map_38.i4.inc.c" +}; + +u64 gMapIStatic39Tex[] = { +#include "assets/archives/map_i_static/map_39.i4.inc.c" +}; diff --git a/assets/c/archives/map_i_static/map_i_static.h b/assets/c/archives/map_i_static/map_i_static.h new file mode 100644 index 000000000..c614bb6f8 --- /dev/null +++ b/assets/c/archives/map_i_static/map_i_static.h @@ -0,0 +1,65 @@ +#ifndef MAP_I_STATIC_H +#define MAP_I_STATIC_H 1 + +#include "ultra64.h" + +extern u64 gMapIStatic00Tex[]; +extern u64 gMapIStatic01Tex[]; +extern u64 gMapIStatic02Tex[]; +extern u64 gMapIStatic03Tex[]; +extern u64 gMapIStatic04Tex[]; +extern u64 gMapIStatic05Tex[]; +extern u64 gMapIStatic06Tex[]; +extern u64 gMapIStatic07Tex[]; +extern u64 gMapIStatic08Tex[]; +extern u64 gMapIStatic09Tex[]; +extern u64 gMapIStatic0ATex[]; +extern u64 gMapIStatic0BTex[]; +extern u64 gMapIStatic0CTex[]; +extern u64 gMapIStatic0DTex[]; +extern u64 gMapIStatic0ETex[]; +extern u64 gMapIStatic0FTex[]; +extern u64 gMapIStatic10Tex[]; +extern u64 gMapIStatic11Tex[]; +extern u64 gMapIStatic12Tex[]; +extern u64 gMapIStatic13Tex[]; +extern u64 gMapIStatic14Tex[]; +extern u64 gMapIStatic15Tex[]; +extern u64 gMapIStatic16Tex[]; +extern u64 gMapIStatic17Tex[]; +extern u64 gMapIStatic18Tex[]; +extern u64 gMapIStatic19Tex[]; +extern u64 gMapIStatic1ATex[]; +extern u64 gMapIStatic1BTex[]; +extern u64 gMapIStatic1CTex[]; +extern u64 gMapIStatic1DTex[]; +extern u64 gMapIStatic1ETex[]; +extern u64 gMapIStatic1FTex[]; +extern u64 gMapIStatic20Tex[]; +extern u64 gMapIStatic21Tex[]; +extern u64 gMapIStatic22Tex[]; +extern u64 gMapIStatic23Tex[]; +extern u64 gMapIStatic24Tex[]; +extern u64 gMapIStatic25Tex[]; +extern u64 gMapIStatic26Tex[]; +extern u64 gMapIStatic27Tex[]; +extern u64 gMapIStatic28Tex[]; +extern u64 gMapIStatic29Tex[]; +extern u64 gMapIStatic2ATex[]; +extern u64 gMapIStatic2BTex[]; +extern u64 gMapIStatic2CTex[]; +extern u64 gMapIStatic2DTex[]; +extern u64 gMapIStatic2ETex[]; +extern u64 gMapIStatic2FTex[]; +extern u64 gMapIStatic30Tex[]; +extern u64 gMapIStatic31Tex[]; +extern u64 gMapIStatic32Tex[]; +extern u64 gMapIStatic33Tex[]; +extern u64 gMapIStatic34Tex[]; +extern u64 gMapIStatic35Tex[]; +extern u64 gMapIStatic36Tex[]; +extern u64 gMapIStatic37Tex[]; +extern u64 gMapIStatic38Tex[]; +extern u64 gMapIStatic39Tex[]; + +#endif diff --git a/assets/xml/archives/map_grand_static.xml b/assets/xml/archives/map_grand_static.xml index d5d80bdd6..05e5893c1 100644 --- a/assets/xml/archives/map_grand_static.xml +++ b/assets/xml/archives/map_grand_static.xml @@ -1,102 +1,102 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/archives/map_i_static.xml b/assets/xml/archives/map_i_static.xml index dbb64185d..fce2cc437 100644 --- a/assets/xml/archives/map_i_static.xml +++ b/assets/xml/archives/map_i_static.xml @@ -1,62 +1,62 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_test3.xml b/assets/xml/objects/object_test3.xml index 678e11693..c32732b35 100644 --- a/assets/xml/objects/object_test3.xml +++ b/assets/xml/objects/object_test3.xml @@ -1,78 +1,88 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/extract_assets.py b/extract_assets.py index dda5efaec..4d64d7d13 100755 --- a/extract_assets.py +++ b/extract_assets.py @@ -6,6 +6,11 @@ colorama.init() EXTRACTED_ASSETS_NAMEFILE = ".extracted-assets.json" +dontGenerateCFilesList = [ + "map_grand_static", + "map_i_static", +] + def SignalHandler(sig, frame): print(f'Signal {sig} received. Aborting...') mainAbort.set() @@ -16,7 +21,13 @@ def ExtractFile(xmlPath, outputPath, outputSourcePath): # Don't extract if another file wasn't extracted properly. return - execStr = f"tools/ZAPD/ZAPD.out e -eh -i {xmlPath} -b baserom/ -o {outputPath} -osf {outputSourcePath} -gsf 1 -rconf tools/ZAPDConfigs/MM/Config.xml {ZAPDArgs}" + generateSourceFile = "1" + for name in dontGenerateCFilesList: + if name in xmlPath: + generateSourceFile = "0" + break + + execStr = f"tools/ZAPD/ZAPD.out e -eh -i {xmlPath} -b baserom/ -o {outputPath} -osf {outputSourcePath} -gsf {generateSourceFile} -rconf tools/ZAPDConfigs/MM/Config.xml {ZAPDArgs}" if globalUnaccounted: execStr += " -Wunaccounted" diff --git a/include/PR/r4300.h b/include/PR/R4300.h similarity index 100% rename from include/PR/r4300.h rename to include/PR/R4300.h diff --git a/include/PR/controller.h b/include/PR/controller.h index 8f5f35fe6..367912452 100644 --- a/include/PR/controller.h +++ b/include/PR/controller.h @@ -142,8 +142,6 @@ typedef struct { /* 0x7 */ s8 stick_y; } __OSContReadFormat; - -// Original name: __OSContRequesFormat typedef struct { /* 0x00 */ u8 align; /* 0x01 */ u8 txsize; @@ -153,7 +151,7 @@ typedef struct { /* 0x05 */ u8 typel; /* 0x06 */ u8 status; /* 0x07 */ u8 align1; -} __OSContRequestHeader; // size = 0x8 +} __OSContRequesFormat; // size = 0x8 typedef struct { /* 0x00 */ u8 txsize; diff --git a/include/PR/hardware.h b/include/PR/hardware.h deleted file mode 100644 index c6f27bdff..000000000 --- a/include/PR/hardware.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _ULTRA64_HARDWARE_H_ -#define _ULTRA64_HARDWARE_H_ - -// TODO: not real libultra header. Refactor to R4300.h - -// Segment Wrapper -// Uncached RDRAM -#define KSEG1 0xA0000000 // 0xA0000000 - 0xBFFFFFFF Physical memory, uncached, unmapped -#define RDRAM_UNCACHED KSEG1 - -// Cached RDRAM -#define KSEG0 0x80000000 // 0x80000000 - 0x9FFFFFFF Physical memory, cached, unmapped -#define RDRAM_CACHED KSEG0 - -// Volatile access wrapper, enforcing uncached memory -#define HW_REG(reg, type) *(volatile type*)((reg) | KSEG1) - -#define TMEM_SIZE 0x1000 - -#define MI_INIT_MODE_REG 0x04300000 -#define MI_MODE_REG MI_INIT_MODE_REG -#define MI_VERSION_REG 0x04300004 -#define MI_INTR_REG 0x04300008 -#define MI_INTR_MASK_REG 0x0430000C - -/* Interrupt pending bits */ -#define CAUSE_IP8 0x00008000 /* External level 8 pending - COMPARE */ -#define CAUSE_IP7 0x00004000 /* External level 7 pending - INT4 */ -#define CAUSE_IP6 0x00002000 /* External level 6 pending - INT3 */ -#define CAUSE_IP5 0x00001000 /* External level 5 pending - INT2 */ -#define CAUSE_IP4 0x00000800 /* External level 4 pending - INT1 */ -#define CAUSE_IP3 0x00000400 /* External level 3 pending - INT0 */ -#define CAUSE_SW2 0x00000200 /* Software level 2 pending */ -#define CAUSE_SW1 0x00000100 /* Software level 1 pending */ - -#endif diff --git a/include/PR/os.h b/include/PR/os.h index 1b39d79a1..8b55f5bcb 100644 --- a/include/PR/os.h +++ b/include/PR/os.h @@ -24,4 +24,15 @@ #include "os_vi.h" #include "os_voice.h" +/* + * Stack size for I/O device managers: PIM (PI Manager), VIM (VI Manager), + * SIM (SI Manager) + * + */ +#define OS_PIM_STACKSIZE 4096 +#define OS_VIM_STACKSIZE 4096 +#define OS_SIM_STACKSIZE 4096 + +#define OS_MIN_STACKSIZE 72 + #endif diff --git a/include/PR/os_exception.h b/include/PR/os_exception.h index b5c2e7ba8..7140c9663 100644 --- a/include/PR/os_exception.h +++ b/include/PR/os_exception.h @@ -7,13 +7,41 @@ typedef u32 OSIntMask; typedef u32 OSHWIntr; +/* Flags for debugging purpose */ + +#define OS_FLAG_CPU_BREAK 1 /* Break exception has occurred */ +#define OS_FLAG_FAULT 2 /* CPU fault has occurred */ + +/* Interrupt masks */ + +#define OS_IM_NONE 0x00000001 +#define OS_IM_RCP 0x00000401 +#define OS_IM_SW1 0x00000501 +#define OS_IM_SW2 0x00000601 +#define OS_IM_CART 0x00000c01 +#define OS_IM_PRENMI 0x00001401 +#define OS_IM_RDBWRITE 0x00002401 +#define OS_IM_RDBREAD 0x00004401 +#define OS_IM_COUNTER 0x00008401 +#define OS_IM_CPU 0x0000FF01 +#define OS_IM_SP 0x00010401 +#define OS_IM_SI 0x00020401 +#define OS_IM_AI 0x00040401 +#define OS_IM_VI 0x00080401 +#define OS_IM_PI 0x00100401 +#define OS_IM_DP 0x00200401 +#define OS_IM_ALL 0x003FFF01 +#define RCP_IMASK 0x003F0000 +#define RCP_IMASKSHIFT 16 + + OSIntMask osGetIntMask(void); OSIntMask osSetIntMask(OSIntMask im); // Internal -void __osSetHWIntrRoutine(OSHWIntr idx, OSMesgQueue* queue, OSMesg msg); -void __osGetHWIntrRoutine(OSHWIntr idx, OSMesgQueue** outQueue, OSMesg* outMsg); +void __osSetHWIntrRoutine(OSHWIntr interrupt, s32 (*handler)(void), void* stackEnd); +void __osGetHWIntrRoutine(OSHWIntr interrupt, s32 (**handler)(void), void** stackEnd); void __osSetGlobalIntMask(OSHWIntr mask); void __osResetGlobalIntMask(OSHWIntr mask); diff --git a/include/PR/os_internal.h b/include/PR/os_internal.h index 58e660801..f2c5bfa17 100644 --- a/include/PR/os_internal.h +++ b/include/PR/os_internal.h @@ -7,18 +7,8 @@ #include "os_internal_rsp.h" typedef struct __osHwInt { - /* 0x00 */ OSMesgQueue* queue; - /* 0x04 */ OSMesg msg; + /* 0x00 */ s32 (*handler)(void); + /* 0x04 */ void* stackEnd; } __osHwInt; // size = 0x08 -typedef struct { - /* 0x00 */ u32 initialized; - /* 0x04 */ OSThread* mgrThread; - /* 0x08 */ OSMesgQueue* cmdQueue; - /* 0x0C */ OSMesgQueue* eventQueue; - /* 0x10 */ OSMesgQueue* accessQueue; - /* 0x14 */ s32 (*piDmaCallback)(s32, uintptr_t, void*, size_t); - /* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, uintptr_t, void*, size_t); -} OSMgrArgs; // size = 0x1C - #endif diff --git a/include/PR/os_internal_rsp.h b/include/PR/os_internal_rsp.h index ce72a146b..a79426bc7 100644 --- a/include/PR/os_internal_rsp.h +++ b/include/PR/os_internal_rsp.h @@ -5,7 +5,7 @@ u32 __osSpGetStatus(void); void __osSpSetStatus(u32 data); -s32 __osSpSetPc(void* pc); -s32 __osSpRawStartDma(s32 direction, void* devAddr, void* dramAddr, size_t size); +s32 __osSpSetPc(u32 pc); +s32 __osSpRawStartDma(s32 direction, u32 devAddr, void* dramAddr, size_t size); #endif diff --git a/include/PR/os_time.h b/include/PR/os_time.h index 31702c0bb..d0da9b8a9 100644 --- a/include/PR/os_time.h +++ b/include/PR/os_time.h @@ -18,7 +18,7 @@ typedef struct OSTimer_s { OSTime osGetTime(void); void osSetTime(OSTime ticks); -s32 osSetTimer(OSTimer* t, OSTime value, OSTime interval, OSMesgQueue* mq, OSMesg msg); +s32 osSetTimer(OSTimer* t, OSTime countdown, OSTime interval, OSMesgQueue* mq, OSMesg msg); s32 osStopTimer(OSTimer* t); diff --git a/include/PR/os_vi.h b/include/PR/os_vi.h index d2872962b..041622916 100644 --- a/include/PR/os_vi.h +++ b/include/PR/os_vi.h @@ -115,6 +115,12 @@ typedef struct { #define OS_VI_UNK28 28 +extern OSViMode osViModeNtscHpf1; +extern OSViMode osViModePalLan1; +extern OSViMode osViModeNtscHpn1; +extern OSViMode osViModeNtscLan1; +extern OSViMode osViModeMpalLan1; +extern OSViMode osViModeFpalLan1; extern OSViMode osViModeNtscHpf1; extern OSViMode osViModePalLan1; @@ -127,7 +133,7 @@ void* osViGetCurrentFramebuffer(void); void* osViGetNextFramebuffer(void); void osViSetXScale(f32 value); void osViSetYScale(f32 value); -void osViExtendVStart(u32 a0); +void osViExtendVStart(u32 value); void osViSetSpecialFeatures(u32 func); void osViSetMode(OSViMode* modep); void osViSetEvent(OSMesgQueue* mq, OSMesg m, u32 retraceCount); diff --git a/include/PR/piint.h b/include/PR/piint.h index 91d966706..8517f9d63 100644 --- a/include/PR/piint.h +++ b/include/PR/piint.h @@ -5,6 +5,81 @@ #include "os_pi.h" #include "libc/stdint.h" +#define LEO_BASE_REG 0x05000000 + +#define LEO_CMD (LEO_BASE_REG + 0x508) +#define LEO_STATUS (LEO_BASE_REG + 0x508) + +#define LEO_BM_CTL (LEO_BASE_REG + 0x510) +#define LEO_BM_STATUS (LEO_BASE_REG + 0x510) + +#define LEO_SEQ_CTL (LEO_BASE_REG + 0x518) +#define LEO_SEQ_STATUS (LEO_BASE_REG + 0x518) + +#define LEO_C2_BUFF (LEO_BASE_REG + 0x000) // C2 Sector Buffer +#define LEO_SECTOR_BUFF (LEO_BASE_REG + 0x400) // Data Sector Buffer +#define LEO_DATA (LEO_BASE_REG + 0x500) // Data +#define LEO_MISC_REG (LEO_BASE_REG + 0x504) // Misc Register +#define LEO_CUR_TK (LEO_BASE_REG + 0x50C) // Current Track +#define LEO_ERR_SECTOR (LEO_BASE_REG + 0x514) // Sector Error Status +#define LEO_CUR_SECTOR (LEO_BASE_REG + 0x51C) // Current Sector +#define LEO_HARD_RESET (LEO_BASE_REG + 0x520) // Hard Reset +#define LEO_C1_S0 (LEO_BASE_REG + 0x524) // C1 +#define LEO_HOST_SECBYTE (LEO_BASE_REG + 0x528) // Sector Size (in bytes) +#define LEO_C1_S2 (LEO_BASE_REG + 0x52C) // C1 +#define LEO_SEC_BYTE (LEO_BASE_REG + 0x530) // Sectors per Block, Full Size +#define LEO_C1_S4 (LEO_BASE_REG + 0x534) // C1 +#define LEO_C1_S6 (LEO_BASE_REG + 0x538) // C1 +#define LEO_CUR_ADDR (LEO_BASE_REG + 0x53C) // Current Address? +#define LEO_ID_REG (LEO_BASE_REG + 0x540) // ID +#define LEO_TEST_REG (LEO_BASE_REG + 0x544) // Test Read +#define LEO_TEST_PIN_SEL (LEO_BASE_REG + 0x548) // Test Write +#define LEO_RAM_ADDR (LEO_BASE_REG + 0x580) // Microsequencer RAM + +#define LEO_STATUS_PRESENCE_MASK 0xFFFF + +#define LEO_STATUS_DATA_REQUEST 0x40000000 +#define LEO_STATUS_C2_TRANSFER 0x10000000 +#define LEO_STATUS_BUFFER_MANAGER_ERROR 0x08000000 +#define LEO_STATUS_BUFFER_MANAGER_INTERRUPT 0x04000000 +#define LEO_STATUS_MECHANIC_INTERRUPT 0x02000000 +#define LEO_STATUS_DISK_PRESENT 0x01000000 +#define LEO_STATUS_BUSY_STATE 0x00800000 +#define LEO_STATUS_RESET_STATE 0x00400000 +#define LEO_STATUS_MOTOR_NOT_SPINNING 0x00100000 +#define LEO_STATUS_HEAD_RETRACTED 0x00080000 +#define LEO_STATUS_WRITE_PROTECT_ERROR 0x00040000 +#define LEO_STATUS_MECHANIC_ERROR 0x00020000 +#define LEO_STATUS_DISK_CHANGE 0x00010000 + +#define LEO_STATUS_MODE_MASK (LEO_STATUS_MOTOR_NOT_SPINNING | LEO_STATUS_HEAD_RETRACTED) +#define LEO_STATUS_MODE_SLEEP (LEO_STATUS_MOTOR_NOT_SPINNING | LEO_STATUS_HEAD_RETRACTED) +#define LEO_STATUS_MODE_STANDBY (LEO_STATUS_HEAD_RETRACTED) +#define LEO_STATUS_MODE_ACTIVE 0 + +#define LEO_CUR_TK_INDEX_LOCK 0x60000000 + +#define LEO_BM_STATUS_RUNNING 0x80000000 // Running +#define LEO_BM_STATUS_ERROR 0x04000000 // Error +#define LEO_BM_STATUS_MICRO 0x02000000 // Micro Status? +#define LEO_BM_STATUS_BLOCK 0x01000000 // Block Transfer +#define LEO_BM_STATUS_C1CORRECTION 0x00800000 // C1 Correction +#define LEO_BM_STATUS_C1DOUBLE 0x00400000 // C1 Double +#define LEO_BM_STATUS_C1SINGLE 0x00200000 // C1 Single +#define LEO_BM_STATUS_C1ERROR 0x00010000 // C1 Error + +#define LEO_BM_CTL_START 0x80000000 // Start Buffer Manager +#define LEO_BM_CTL_MODE 0x40000000 // Buffer Manager Mode +#define LEO_BM_CTL_IMASK 0x20000000 // BM Interrupt Mask +#define LEO_BM_CTL_RESET 0x10000000 // Buffer Manager Reset +#define LEO_BM_CTL_DISABLE_OR 0x08000000 // Disable OR Check? +#define LEO_BM_CTL_DISABLE_C1 0x04000000 // Disable C1 Correction +#define LEO_BM_CTL_BLOCK 0x02000000 // Block Transfer +#define LEO_BM_CTL_CLR_MECHANIC_INTR 0x01000000 // Mechanic Interrupt Reset + +#define LEO_BM_CTL_CONTROL_MASK 0xFF000000 +#define LEO_BM_CTL_SECTOR_MASK 0x00FF0000 +#define LEO_BM_CTL_SECTOR_SHIFT 16 extern OSDevMgr __osPiDevMgr; extern OSPiHandle* __osCurrentHandle[]; diff --git a/include/PR/voice_internal.h b/include/PR/voiceinternal.h similarity index 100% rename from include/PR/voice_internal.h rename to include/PR/voiceinternal.h diff --git a/include/alignment.h b/include/alignment.h index e26a1d3f3..f2fd65750 100644 --- a/include/alignment.h +++ b/include/alignment.h @@ -1,16 +1,16 @@ #ifndef ALIGNMENT_H #define ALIGNMENT_H +#include "attributes.h" + #define ALIGN8(val) (((val) + 7) & ~7) #define ALIGN16(val) (((val) + 0xF) & ~0xF) #define ALIGN32(val) (((val) + 0x1F) & ~0x1F) #define ALIGN64(val) (((val) + 0x3F) & ~0x3F) #define ALIGN256(val) (((val) + 0xFF) & ~0xFF) -#ifdef __GNUC__ -#define ALIGNED8 __attribute__ ((aligned (8))) -#else -#define ALIGNED8 +#ifndef ALIGNED +#define ALIGNED(x) __attribute__ ((aligned (x))) #endif #ifdef __sgi /* IDO compiler */ diff --git a/include/attributes.h b/include/attributes.h new file mode 100644 index 000000000..ea54a323e --- /dev/null +++ b/include/attributes.h @@ -0,0 +1,15 @@ +#ifndef ATTRIBUTES_H +#define ATTRIBUTES_H + +// If not building with a modern GCC-like compiler then make any use of __attribute__ a no-op +#if (!defined(__GNUC__) && !defined(__clang__)) || defined(M2CTX) || defined(__sgi) + #ifndef __attribute__ + #define __attribute__(x) + #endif +#endif + +#define UNUSED __attribute__((unused)) +#define FALLTHROUGH __attribute__((fallthrough)) +#define NORETURN __attribute__((noreturn)) + +#endif diff --git a/include/functions.h b/include/functions.h index 829291c25..907c35b5f 100644 --- a/include/functions.h +++ b/include/functions.h @@ -312,8 +312,8 @@ s32 func_800B7128(Player* player); s32 func_800B715C(PlayState* play); void Actor_SetCameraHorseSetting(PlayState* play, Player* player); void Actor_MountHorse(PlayState* play, Player* player, Actor* horse); -s32 func_800B724C(PlayState* play, Actor* actor, u8 csMode); -s32 func_800B7298(PlayState* play, Actor* actor, u8 csMode); +s32 func_800B724C(PlayState* play, Actor* actor, u8 csAction); +s32 func_800B7298(PlayState* play, Actor* actor, u8 csAction); void func_800B72F8(DynaPolyActor* dyna, f32 extraPushForce, s16 yRotation); s32 Player_IsFacingActor(Actor* actor, s16 maxAngleDiff, PlayState* play); @@ -897,17 +897,6 @@ void SkinMatrix_SetYRotation(MtxF* mf, s16 a); void SkinMatrix_MulYRotation(MtxF* mf, s16 a); void SkinMatrix_SetZRotation(MtxF* mf, s16 a); -void func_80140E80(Struct_80140E80* arg0); -void func_80140EA0(Struct_80140E80* arg0); -// void func_80140EAC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_80141008(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10); -void func_8014116C(Gfx** gfxP, u16* arg1, u16* workBuffer, s32 width, s32 height, s32 arg5); -// void func_801411B4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10); -// void func_80141200(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_8014151C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_80141678(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); -void func_80141778(Struct_80140E80* arg0, Gfx** gfxp, void* unk_18E60, GraphicsContext* gfxCtx); - uintptr_t KaleidoManager_FaultAddrConv(uintptr_t address, void* param); void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl); void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl); @@ -1267,6 +1256,14 @@ void AudioScript_InitSequencePlayers(void); void func_8019AE40(s32 param_1, s32 param_2, u32 param_3, s32 param_4); void func_8019AEC0(UNK_PTR param_1, UNK_PTR param_2); +void Audio_Init(void); +void Audio_InitSound(void); +void Audio_Update(void); +void Audio_ResetForAudioHeapStep3(void); +void Audio_ResetForAudioHeapStep2(void); +void Audio_ResetForAudioHeapStep1(s32 specId); +void Audio_PreNMI(void); + void AudioOcarina_SetSongStartingPos(void); void AudioOcarina_StartAtSongStartingPos(u32 ocarinaFlags); void AudioOcarina_StartForSongCheck(u32 ocarinaFlags, u8 ocarinaStaffPlayingPosStart); @@ -1284,68 +1281,59 @@ OcarinaStaff* AudioOcarina_GetPlaybackStaff(void); void AudioOcarina_TerminaWallGenerateNotes(void); void AudioOcarina_PlayLongScarecrowSong(void); -void Audio_Update(void); void AudioSfx_SetProperties(u8 bankId, u8 entryIndex, u8 channelIndex); void AudioSfx_LowerSfxSettingsReverb(Vec3f* pos, s8 isReverbLowered); -void Audio_SetBgmVolumeOff(void); -void Audio_SetBgmVolumeOn(void); -void func_801A0204(s8 seqId); -void Audio_SetMainBgmVolume(u8 targetVolume, u8 volumeFadeTimer); void AudioSfx_SetChannelIO(Vec3f* pos, u16 sfxId, u8 ioData); + void Audio_PlayObjSoundBgm(Vec3f* pos, s8 seqId); void Audio_PlayObjSoundFanfare(Vec3f* pos, s8 seqId); void Audio_PlaySubBgmAtPos(Vec3f* pos, u8 seqId, f32 maxDist); -void Audio_PlaySubBgmAtPosWithFilter(Vec3f* pos, u8 seqId, f32 arg2); +void Audio_PlaySubBgmAtPosWithFilter(Vec3f* pos, u8 seqId, f32 maxDist); void Audio_PlaySequenceAtDefaultPos(u8 seqPlayerIndex, u16 seqId); -void Audio_StopSequenceAtDefaultPos(void); void Audio_PlaySequenceAtPos(u8 seqPlayerIndex, Vec3f* pos, u16 seqId, f32 maxDist); -void func_801A246C(u8 param_1, u8 param_2); void Audio_PlayMorningSceneSequence(u16 seqId, u8 dayMinusOne); void Audio_PlaySceneSequence(u16 seqId, u8 dayMinusOne); -void Audio_SetSeqTempoAndFreq(u8 seqPlayerIndex, f32 freqTempoScale, u8 duration); void Audio_PlaySubBgm(u16 seqId); -void Audio_StopSubBgm(void); void Audio_PlaySequenceInCutscene(u16 seqId); -void Audio_StopSequenceInCutscene(u16 seqId); -s32 Audio_IsSequencePlaying(u8 seqId); void Audio_PlayBgm_StorePrevBgm(u16 seqId); -void Audio_RestorePrevBgm(void); -void func_801A3000(u16 seqId, u8 ioData); -// void func_801A3038(void); +void Audio_PlayFanfareWithPlayerIOPort7(u16 seqId, u8 ioData); void Audio_PlayFanfare(u16 seqId); -// void func_801A312C(void); -void func_801A31EC(u16 seqId, s8 arg1, u8 arg2); +void Audio_PlayFanfareWithPlayerIOCustomPort(u16 seqId, s8 ioPort, u8 ioData); void Audio_PlaySequenceWithSeqPlayerIO(s8 seqPlayerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData); -void Audio_SetSequenceMode(u8 seqMode); -void Audio_UpdateEnemyBgmVolume(f32 dist); -u8 func_801A3950(s32 playerIndex, s32 isChannelIOSet); -u8 func_801A39F8(void); -void func_801A3A7C(s32 arg0); -// void func_801A3AC0(void); -void func_801A3B48(UNK_TYPE arg0); -// void func_801A3B90(void); -void func_801A3CD8(s8 param_1); -void func_801A3CF4(s8 arg0); -void func_801A3D98(s8 audioSetting); -void func_801A3E38(u8 arg0); -void func_801A3EC0(u8 arg0); -void Audio_SetCutsceneFlag(s8 flag); -void Audio_SetSpec(u32 specId); -void func_801A4058(UNK_TYPE arg0); -void func_801A41C8(s32 arg0); -void func_801A41F8(UNK_TYPE arg0); -// void func_801A42C8(void); -// void func_801A4324(void); -// void func_801A4348(void); -void Audio_PreNMI(void); -s32 func_801A46F8(void); -void Audio_SetAmbienceChannelIO(u8 channelIndexRange, u8 ioPort, u8 ioData); void Audio_PlayAmbience(u8 ambienceId); -void Audio_Init(void); -void Audio_InitSound(void); -void Audio_ResetForAudioHeapStep3(void); -void Audio_ResetForAudioHeapStep2(void); -void Audio_ResetForAudioHeapStep1(s32 specId); + +void Audio_StopSequenceAtDefaultPos(void); +void Audio_StopSubBgm(void); +void Audio_StopSequenceInCutscene(u16 seqId); +void Audio_StopFanfare(u16 duration); + +void Audio_SetBgmVolumeOff(void); +void Audio_SetBgmVolumeOn(void); +void Audio_SetMainBgmVolume(u8 targetVolume, u8 volumeFadeTimer); +void Audio_SetSequenceMode(u8 seqMode); +void Audio_SetPauseState(u8 isPauseMenuOpen); +void Audio_SetEnvReverb(s8 reverb); +void Audio_SetCodeReverb(s8 reverb); +void Audio_SetFileSelectSettings(s8 audioSetting); +void Audio_SetBaseFilter(u8 filter); +void Audio_SetExtraFilter(u8 filter); +void Audio_SetCutsceneFlag(s8 flag); +void Audio_SetSpec(u8 specId); +void Audio_SetAmbienceChannelIO(u8 channelIndexRange, u8 ioPort, u8 ioData); +void Audio_SetSeqTempoAndFreq(u8 seqPlayerIndex, f32 freqTempoScale, u8 duration); + +void Audio_MuteSeqPlayerBgmSub(u8 isMuted); +void Audio_MuteAllSeqExceptSystemAndOcarina(u16 duration); +void Audio_MuteSfxAndAmbienceSeqExceptSysAndOca(u16 duration); + +void func_801A0204(s8 seqId); +void func_801A246C(u8 seqPlayerIndex, u8 type); +s32 Audio_IsSequencePlaying(u8 seqId); +void Audio_RestorePrevBgm(void); +void Audio_UpdateEnemyBgmVolume(f32 dist); +u8 func_801A3950(u8 seqPlayerIndex, u8 resetChannelIO); +u8 func_801A39F8(void); +s32 func_801A46F8(void); void func_801A4EB0(void); // void func_801A4EB8(void); diff --git a/include/gfx.h b/include/gfx.h index 63b3eadfc..87f949d8b 100644 --- a/include/gfx.h +++ b/include/gfx.h @@ -9,6 +9,8 @@ struct GameState; +#define TMEM_SIZE 0x1000 + typedef enum SetupDL { /* 0x00 */ SETUPDL_0, /* 0x01 */ SETUPDL_1, @@ -272,4 +274,13 @@ extern Gfx gEmptyDL[]; } \ (void)0 +// used only by code_80140E80 +#define gDPSetLODColor(pkt, c, m, l, d) \ + _DW({ \ + Gfx* _g = (Gfx*)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(c, 24, 8) | _SHIFTL(m, 8, 8) | _SHIFTL(l, 0, 8)); \ + _g->words.w1 = (unsigned int)(d); \ + }) + #endif diff --git a/include/macros.h b/include/macros.h index bc7439394..223a12e8e 100644 --- a/include/macros.h +++ b/include/macros.h @@ -21,10 +21,7 @@ #define ARRAY_COUNT_2D(arr) (ARRAY_COUNT(arr) * ARRAY_COUNT(arr[0])) -// TODO: After uintptr_t cast change should have an AVOID_UB target that just toggles the KSEG0 bit in the address rather than add/sub 0x80000000 -#define PHYSICAL_TO_VIRTUAL(addr) ((uintptr_t)(addr) + RDRAM_CACHED) -#define VIRTUAL_TO_PHYSICAL(addr) (uintptr_t)((u8*)(addr) - RDRAM_CACHED) -#define SEGMENTED_TO_VIRTUAL(addr) (void*)(PHYSICAL_TO_VIRTUAL(gSegments[SEGMENT_NUMBER(addr)]) + SEGMENT_OFFSET(addr)) +#define SEGMENTED_TO_K0(addr) (void*)((gSegments[SEGMENT_NUMBER(addr)] + K0BASE) + SEGMENT_OFFSET(addr)) #define GET_ACTIVE_CAM(play) ((play)->cameraPtrs[(play)->activeCamId]) @@ -92,7 +89,10 @@ #define ABS_ALT(x) ((x) < 0 ? -(x) : (x)) #define DECR(x) ((x) == 0 ? 0 : --(x)) +//! checks min first #define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x)) +//! checks max first +#define CLAMP_ALT(x, min, max) ((x) > (max) ? (max) : (x) < (min) ? (min) : (x)) #define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x)) #define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x)) diff --git a/include/ultra64.h b/include/ultra64.h index 9f810a733..2a834aaa6 100644 --- a/include/ultra64.h +++ b/include/ultra64.h @@ -7,7 +7,6 @@ #include "PR/gu.h" #include "PR/guint.h" #include "PR/controller_voice.h" -#include "PR/hardware.h" #include "PR/os.h" #include "PR/osint.h" #include "PR/piint.h" @@ -15,7 +14,7 @@ #include "PR/sptask.h" #include "PR/rcp.h" #include "PR/rdp.h" -#include "PR/r4300.h" +#include "PR/R4300.h" #include "PR/ucode.h" #include "PR/viint.h" #include "PR/xstdio.h" diff --git a/include/variables.h b/include/variables.h index 41c8f3966..9c0df58f4 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1805,8 +1805,8 @@ extern s32 D_801FD120; // extern UNK_TYPE1 D_801FD29C; // extern UNK_TYPE1 D_801FD2A0; // extern UNK_TYPE1 D_801FD2A8; -// extern UNK_TYPE1 D_801FD3A8; -// extern UNK_TYPE1 D_801FD3A9; +// extern UNK_TYPE1 sRomaniSingingTimer; +// extern UNK_TYPE1 sRomaniSingingDisabled; // extern UNK_TYPE1 D_801FD3AA; // extern UNK_TYPE1 D_801FD3AB; // extern UNK_TYPE1 D_801FD3AC; diff --git a/include/z64.h b/include/z64.h index 57c25047e..072a1296a 100644 --- a/include/z64.h +++ b/include/z64.h @@ -208,7 +208,7 @@ typedef struct PlayState { /* 0x18770 */ void (*unk_18770)(struct PlayState* play, Player* player); /* 0x18774 */ s32 (*startPlayerFishing)(struct PlayState* play); /* 0x18778 */ s32 (*grabPlayer)(struct PlayState* play, Player* player); - /* 0x1877C */ s32 (*startPlayerCutscene)(struct PlayState* play, Player* player, PlayerCsMode csMode); + /* 0x1877C */ s32 (*startPlayerCutscene)(struct PlayState* play, Player* player, PlayerCsAction csAction); /* 0x18780 */ void (*func_18780)(Player* player, struct PlayState* play); /* 0x18784 */ s32 (*damagePlayer)(struct PlayState* play, s32 damage); /* 0x18788 */ void (*talkWithPlayer)(struct PlayState* play, Actor* actor); @@ -271,12 +271,4 @@ typedef enum { /* 3 */ PICTO_PHOTO_STATE_READY } PictoPhotoState; -typedef struct { - /* 0x00 */ u8 mode; - /* 0x04 */ f32 scale; - /* 0x08 */ f32 lodProportion; // expected to be between 0.0f and 1.0f - /* 0x0C */ Color_RGBA8_u32 primColor; - /* 0x10 */ Color_RGBA8_u32 envColor; -} Struct_80140E80; // size = 0x14 - #endif diff --git a/include/z64camera.h b/include/z64camera.h index ba0f6a614..da27353fd 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -2,7 +2,11 @@ #define Z64CAMERA_H #include "ultra64.h" +#include "z64actor.h" #include "z64save.h" +#include "unk.h" + +struct CollisionPoly; // these two angle conversion macros are slightly inaccurate #define CAM_DEG_TO_BINANG(degrees) (s16)((degrees) * ((f32)0xFFFF / 360) + .5f) @@ -373,7 +377,7 @@ typedef enum { typedef struct { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f norm; - /* 0x18 */ CollisionPoly* poly; + /* 0x18 */ struct CollisionPoly* poly; /* 0x1C */ VecGeo geoNorm; /* 0x24 */ s32 bgId; } CameraCollision; // size = 0x28 diff --git a/include/z64cutscene.h b/include/z64cutscene.h index 69cc5ce50..8cdd01a66 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -560,8 +560,8 @@ typedef enum { /* 0x1B */ CS_MISC_DEST_MOON_CRASH_FIRE_WALL, /* 0x1C */ CS_MISC_MOON_CRASH_SKYBOX, /* 0x1D */ CS_MISC_PLAYER_FORM_RESTORED, - /* 0x1E */ CS_MISC_DISABLE_PLAYER_CSMODE_START_POS, - /* 0x1F */ CS_MISC_ENABLE_PLAYER_CSMODE_START_POS, + /* 0x1E */ CS_MISC_DISABLE_PLAYER_CSACTION_START_POS, + /* 0x1F */ CS_MISC_ENABLE_PLAYER_CSACTION_START_POS, /* 0x20 */ CS_MISC_UNIMPLEMENTED_20, /* 0x21 */ CS_MISC_SAVE_ENTER_CLOCK_TOWN, /* 0x22 */ CS_MISC_RESET_SAVE_FROM_MOON_CRASH, @@ -859,7 +859,7 @@ s32 CutsceneFlags_Get(struct PlayState* play, s16 flag); extern u8 gOpeningEntranceIndex; extern u8 D_801F4DDC; -extern u8 gDisablePlayerCsModeStartPos; +extern u8 gDisablePlayerCsActionStartPos; extern s16 gDungeonBossWarpSceneId; #endif diff --git a/include/z64player.h b/include/z64player.h index 3f0af150a..a5f268627 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -606,149 +606,149 @@ typedef struct struct_80122744_arg1 { /* 0x4 */ Vec3s* unk_04; } struct_80122744_arg1; // size = 0x8 -typedef enum PlayerCsMode { - /* 0x00 */ PLAYER_CSMODE_NONE, - /* 0x01 */ PLAYER_CSMODE_1, - /* 0x02 */ PLAYER_CSMODE_2, - /* 0x03 */ PLAYER_CSMODE_3, - /* 0x04 */ PLAYER_CSMODE_4, - /* 0x05 */ PLAYER_CSMODE_5, - /* 0x06 */ PLAYER_CSMODE_END, - /* 0x07 */ PLAYER_CSMODE_WAIT, - /* 0x08 */ PLAYER_CSMODE_8, - /* 0x09 */ PLAYER_CSMODE_9, - /* 0x0A */ PLAYER_CSMODE_10, - /* 0x0B */ PLAYER_CSMODE_11, - /* 0x0C */ PLAYER_CSMODE_12, - /* 0x0D */ PLAYER_CSMODE_13, - /* 0x0E */ PLAYER_CSMODE_14, - /* 0x0F */ PLAYER_CSMODE_15, - /* 0x10 */ PLAYER_CSMODE_16, - /* 0x11 */ PLAYER_CSMODE_17, - /* 0x12 */ PLAYER_CSMODE_18, // Strangled by Wallmaster - /* 0x13 */ PLAYER_CSMODE_19, - /* 0x14 */ PLAYER_CSMODE_20, - /* 0x15 */ PLAYER_CSMODE_21, - /* 0x16 */ PLAYER_CSMODE_22, - /* 0x17 */ PLAYER_CSMODE_23, - /* 0x18 */ PLAYER_CSMODE_24, - /* 0x19 */ PLAYER_CSMODE_25, - /* 0x1A */ PLAYER_CSMODE_26, // Halt! - /* 0x1B */ PLAYER_CSMODE_27, - /* 0x1C */ PLAYER_CSMODE_28, - /* 0x1D */ PLAYER_CSMODE_29, - /* 0x1E */ PLAYER_CSMODE_30, - /* 0x1F */ PLAYER_CSMODE_31, - /* 0x20 */ PLAYER_CSMODE_32, - /* 0x21 */ PLAYER_CSMODE_33, - /* 0x22 */ PLAYER_CSMODE_34, - /* 0x23 */ PLAYER_CSMODE_35, - /* 0x24 */ PLAYER_CSMODE_36, - /* 0x25 */ PLAYER_CSMODE_37, - /* 0x26 */ PLAYER_CSMODE_38, - /* 0x27 */ PLAYER_CSMODE_39, - /* 0x28 */ PLAYER_CSMODE_40, - /* 0x29 */ PLAYER_CSMODE_41, - /* 0x2A */ PLAYER_CSMODE_42, - /* 0x2B */ PLAYER_CSMODE_43, - /* 0x2C */ PLAYER_CSMODE_44, - /* 0x2D */ PLAYER_CSMODE_45, - /* 0x2E */ PLAYER_CSMODE_46, - /* 0x2F */ PLAYER_CSMODE_47, - /* 0x30 */ PLAYER_CSMODE_48, - /* 0x31 */ PLAYER_CSMODE_49, - /* 0x32 */ PLAYER_CSMODE_50, - /* 0x33 */ PLAYER_CSMODE_51, - /* 0x34 */ PLAYER_CSMODE_52, - /* 0x35 */ PLAYER_CSMODE_53, - /* 0x36 */ PLAYER_CSMODE_54, - /* 0x37 */ PLAYER_CSMODE_55, - /* 0x38 */ PLAYER_CSMODE_56, - /* 0x39 */ PLAYER_CSMODE_57, - /* 0x3A */ PLAYER_CSMODE_58, - /* 0x3B */ PLAYER_CSMODE_59, - /* 0x3C */ PLAYER_CSMODE_60, - /* 0x3D */ PLAYER_CSMODE_61, - /* 0x3E */ PLAYER_CSMODE_62, - /* 0x3F */ PLAYER_CSMODE_63, - /* 0x40 */ PLAYER_CSMODE_64, - /* 0x41 */ PLAYER_CSMODE_65, - /* 0x42 */ PLAYER_CSMODE_66, // Look side-to-side with chin down - /* 0x43 */ PLAYER_CSMODE_67, - /* 0x44 */ PLAYER_CSMODE_68, - /* 0x45 */ PLAYER_CSMODE_69, - /* 0x46 */ PLAYER_CSMODE_70, - /* 0x47 */ PLAYER_CSMODE_71, - /* 0x48 */ PLAYER_CSMODE_72, - /* 0x49 */ PLAYER_CSMODE_73, - /* 0x4A */ PLAYER_CSMODE_74, // Give a big nod of approval - /* 0x4B */ PLAYER_CSMODE_75, - /* 0x4C */ PLAYER_CSMODE_76, - /* 0x4D */ PLAYER_CSMODE_77, - /* 0x4E */ PLAYER_CSMODE_78, - /* 0x4F */ PLAYER_CSMODE_79, - /* 0x50 */ PLAYER_CSMODE_80, - /* 0x51 */ PLAYER_CSMODE_81, // Look side-to-side with chin up - /* 0x52 */ PLAYER_CSMODE_82, // Close eyes and sway body in circles - /* 0x53 */ PLAYER_CSMODE_83, - /* 0x54 */ PLAYER_CSMODE_84, // Sucked by the moon - /* 0x55 */ PLAYER_CSMODE_85, - /* 0x56 */ PLAYER_CSMODE_86, - /* 0x57 */ PLAYER_CSMODE_87, - /* 0x58 */ PLAYER_CSMODE_88, - /* 0x59 */ PLAYER_CSMODE_89, - /* 0x5A */ PLAYER_CSMODE_90, - /* 0x5B */ PLAYER_CSMODE_91, - /* 0x5C */ PLAYER_CSMODE_92, - /* 0x5D */ PLAYER_CSMODE_93, - /* 0x5E */ PLAYER_CSMODE_94, - /* 0x5F */ PLAYER_CSMODE_95, - /* 0x60 */ PLAYER_CSMODE_96, - /* 0x61 */ PLAYER_CSMODE_97, - /* 0x62 */ PLAYER_CSMODE_98, - /* 0x63 */ PLAYER_CSMODE_99, - /* 0x64 */ PLAYER_CSMODE_100, - /* 0x65 */ PLAYER_CSMODE_101, - /* 0x66 */ PLAYER_CSMODE_102, - /* 0x67 */ PLAYER_CSMODE_103, - /* 0x68 */ PLAYER_CSMODE_104, - /* 0x69 */ PLAYER_CSMODE_105, - /* 0x6A */ PLAYER_CSMODE_106, - /* 0x6B */ PLAYER_CSMODE_107, - /* 0x6C */ PLAYER_CSMODE_108, - /* 0x6D */ PLAYER_CSMODE_109, - /* 0x6E */ PLAYER_CSMODE_110, - /* 0x6F */ PLAYER_CSMODE_111, - /* 0x70 */ PLAYER_CSMODE_112, - /* 0x71 */ PLAYER_CSMODE_113, - /* 0x72 */ PLAYER_CSMODE_114, - /* 0x73 */ PLAYER_CSMODE_115, - /* 0x74 */ PLAYER_CSMODE_116, - /* 0x75 */ PLAYER_CSMODE_117, - /* 0x76 */ PLAYER_CSMODE_118, - /* 0x77 */ PLAYER_CSMODE_119, - /* 0x78 */ PLAYER_CSMODE_120, - /* 0x79 */ PLAYER_CSMODE_121, - /* 0x7A */ PLAYER_CSMODE_122, - /* 0x7B */ PLAYER_CSMODE_123, - /* 0x7C */ PLAYER_CSMODE_124, - /* 0x7D */ PLAYER_CSMODE_125, - /* 0x7E */ PLAYER_CSMODE_126, - /* 0x7F */ PLAYER_CSMODE_127, - /* 0x80 */ PLAYER_CSMODE_128, - /* 0x81 */ PLAYER_CSMODE_129, - /* 0x82 */ PLAYER_CSMODE_130, - /* 0x83 */ PLAYER_CSMODE_131, - /* 0x84 */ PLAYER_CSMODE_132, - /* 0x85 */ PLAYER_CSMODE_133, - /* 0x86 */ PLAYER_CSMODE_134, - /* 0x87 */ PLAYER_CSMODE_135, - /* 0x88 */ PLAYER_CSMODE_136, - /* 0x89 */ PLAYER_CSMODE_137, - /* 0x8A */ PLAYER_CSMODE_138, - /* 0x8B */ PLAYER_CSMODE_139, - /* 0x8C */ PLAYER_CSMODE_MAX -} PlayerCsMode; +typedef enum PlayerCsAction { + /* 0x00 */ PLAYER_CSACTION_NONE, + /* 0x01 */ PLAYER_CSACTION_1, + /* 0x02 */ PLAYER_CSACTION_2, + /* 0x03 */ PLAYER_CSACTION_3, + /* 0x04 */ PLAYER_CSACTION_4, + /* 0x05 */ PLAYER_CSACTION_5, + /* 0x06 */ PLAYER_CSACTION_END, + /* 0x07 */ PLAYER_CSACTION_WAIT, + /* 0x08 */ PLAYER_CSACTION_8, + /* 0x09 */ PLAYER_CSACTION_9, + /* 0x0A */ PLAYER_CSACTION_10, + /* 0x0B */ PLAYER_CSACTION_11, + /* 0x0C */ PLAYER_CSACTION_12, + /* 0x0D */ PLAYER_CSACTION_13, + /* 0x0E */ PLAYER_CSACTION_14, + /* 0x0F */ PLAYER_CSACTION_15, + /* 0x10 */ PLAYER_CSACTION_16, + /* 0x11 */ PLAYER_CSACTION_17, + /* 0x12 */ PLAYER_CSACTION_18, // Strangled by Wallmaster + /* 0x13 */ PLAYER_CSACTION_19, + /* 0x14 */ PLAYER_CSACTION_20, + /* 0x15 */ PLAYER_CSACTION_21, + /* 0x16 */ PLAYER_CSACTION_22, + /* 0x17 */ PLAYER_CSACTION_23, + /* 0x18 */ PLAYER_CSACTION_24, + /* 0x19 */ PLAYER_CSACTION_25, + /* 0x1A */ PLAYER_CSACTION_26, // Halt! + /* 0x1B */ PLAYER_CSACTION_27, + /* 0x1C */ PLAYER_CSACTION_28, + /* 0x1D */ PLAYER_CSACTION_29, + /* 0x1E */ PLAYER_CSACTION_30, + /* 0x1F */ PLAYER_CSACTION_31, + /* 0x20 */ PLAYER_CSACTION_32, + /* 0x21 */ PLAYER_CSACTION_33, + /* 0x22 */ PLAYER_CSACTION_34, + /* 0x23 */ PLAYER_CSACTION_35, + /* 0x24 */ PLAYER_CSACTION_36, + /* 0x25 */ PLAYER_CSACTION_37, + /* 0x26 */ PLAYER_CSACTION_38, + /* 0x27 */ PLAYER_CSACTION_39, + /* 0x28 */ PLAYER_CSACTION_40, + /* 0x29 */ PLAYER_CSACTION_41, + /* 0x2A */ PLAYER_CSACTION_42, + /* 0x2B */ PLAYER_CSACTION_43, + /* 0x2C */ PLAYER_CSACTION_44, + /* 0x2D */ PLAYER_CSACTION_45, + /* 0x2E */ PLAYER_CSACTION_46, + /* 0x2F */ PLAYER_CSACTION_47, + /* 0x30 */ PLAYER_CSACTION_48, + /* 0x31 */ PLAYER_CSACTION_49, + /* 0x32 */ PLAYER_CSACTION_50, + /* 0x33 */ PLAYER_CSACTION_51, + /* 0x34 */ PLAYER_CSACTION_52, + /* 0x35 */ PLAYER_CSACTION_53, + /* 0x36 */ PLAYER_CSACTION_54, + /* 0x37 */ PLAYER_CSACTION_55, + /* 0x38 */ PLAYER_CSACTION_56, + /* 0x39 */ PLAYER_CSACTION_57, + /* 0x3A */ PLAYER_CSACTION_58, + /* 0x3B */ PLAYER_CSACTION_59, + /* 0x3C */ PLAYER_CSACTION_60, + /* 0x3D */ PLAYER_CSACTION_61, + /* 0x3E */ PLAYER_CSACTION_62, + /* 0x3F */ PLAYER_CSACTION_63, + /* 0x40 */ PLAYER_CSACTION_64, + /* 0x41 */ PLAYER_CSACTION_65, + /* 0x42 */ PLAYER_CSACTION_66, // Look side-to-side with chin down + /* 0x43 */ PLAYER_CSACTION_67, + /* 0x44 */ PLAYER_CSACTION_68, + /* 0x45 */ PLAYER_CSACTION_69, + /* 0x46 */ PLAYER_CSACTION_70, + /* 0x47 */ PLAYER_CSACTION_71, + /* 0x48 */ PLAYER_CSACTION_72, + /* 0x49 */ PLAYER_CSACTION_73, + /* 0x4A */ PLAYER_CSACTION_74, // Give a big nod of approval + /* 0x4B */ PLAYER_CSACTION_75, + /* 0x4C */ PLAYER_CSACTION_76, + /* 0x4D */ PLAYER_CSACTION_77, + /* 0x4E */ PLAYER_CSACTION_78, + /* 0x4F */ PLAYER_CSACTION_79, + /* 0x50 */ PLAYER_CSACTION_80, + /* 0x51 */ PLAYER_CSACTION_81, // Look side-to-side with chin up + /* 0x52 */ PLAYER_CSACTION_82, // Close eyes and sway body in circles + /* 0x53 */ PLAYER_CSACTION_83, + /* 0x54 */ PLAYER_CSACTION_84, // Sucked by the moon + /* 0x55 */ PLAYER_CSACTION_85, + /* 0x56 */ PLAYER_CSACTION_86, + /* 0x57 */ PLAYER_CSACTION_87, + /* 0x58 */ PLAYER_CSACTION_88, + /* 0x59 */ PLAYER_CSACTION_89, + /* 0x5A */ PLAYER_CSACTION_90, + /* 0x5B */ PLAYER_CSACTION_91, + /* 0x5C */ PLAYER_CSACTION_92, + /* 0x5D */ PLAYER_CSACTION_93, + /* 0x5E */ PLAYER_CSACTION_94, + /* 0x5F */ PLAYER_CSACTION_95, + /* 0x60 */ PLAYER_CSACTION_96, + /* 0x61 */ PLAYER_CSACTION_97, + /* 0x62 */ PLAYER_CSACTION_98, + /* 0x63 */ PLAYER_CSACTION_99, + /* 0x64 */ PLAYER_CSACTION_100, + /* 0x65 */ PLAYER_CSACTION_101, + /* 0x66 */ PLAYER_CSACTION_102, + /* 0x67 */ PLAYER_CSACTION_103, + /* 0x68 */ PLAYER_CSACTION_104, + /* 0x69 */ PLAYER_CSACTION_105, + /* 0x6A */ PLAYER_CSACTION_106, + /* 0x6B */ PLAYER_CSACTION_107, + /* 0x6C */ PLAYER_CSACTION_108, + /* 0x6D */ PLAYER_CSACTION_109, + /* 0x6E */ PLAYER_CSACTION_110, + /* 0x6F */ PLAYER_CSACTION_111, + /* 0x70 */ PLAYER_CSACTION_112, + /* 0x71 */ PLAYER_CSACTION_113, + /* 0x72 */ PLAYER_CSACTION_114, + /* 0x73 */ PLAYER_CSACTION_115, + /* 0x74 */ PLAYER_CSACTION_116, + /* 0x75 */ PLAYER_CSACTION_117, + /* 0x76 */ PLAYER_CSACTION_118, + /* 0x77 */ PLAYER_CSACTION_119, + /* 0x78 */ PLAYER_CSACTION_120, + /* 0x79 */ PLAYER_CSACTION_121, + /* 0x7A */ PLAYER_CSACTION_122, + /* 0x7B */ PLAYER_CSACTION_123, + /* 0x7C */ PLAYER_CSACTION_124, + /* 0x7D */ PLAYER_CSACTION_125, + /* 0x7E */ PLAYER_CSACTION_126, + /* 0x7F */ PLAYER_CSACTION_127, + /* 0x80 */ PLAYER_CSACTION_128, + /* 0x81 */ PLAYER_CSACTION_129, + /* 0x82 */ PLAYER_CSACTION_130, + /* 0x83 */ PLAYER_CSACTION_131, + /* 0x84 */ PLAYER_CSACTION_132, + /* 0x85 */ PLAYER_CSACTION_133, + /* 0x86 */ PLAYER_CSACTION_134, + /* 0x87 */ PLAYER_CSACTION_135, + /* 0x88 */ PLAYER_CSACTION_136, + /* 0x89 */ PLAYER_CSACTION_137, + /* 0x8A */ PLAYER_CSACTION_138, + /* 0x8B */ PLAYER_CSACTION_139, + /* 0x8C */ PLAYER_CSACTION_MAX +} PlayerCsAction; typedef enum PlayerCueId { /* 0x00 */ PLAYER_CUEID_NONE, @@ -1141,8 +1141,8 @@ typedef struct Player { /* 0x388 */ Actor* interactRangeActor; /* 0x38C */ s8 mountSide; /* 0x390 */ Actor* rideActor; - /* 0x394 */ u8 csMode; // PlayerCsMode enum - /* 0x395 */ u8 prevCsMode; // PlayerCsMode enum + /* 0x394 */ u8 csAction; // PlayerCsAction enum + /* 0x395 */ u8 prevCsAction; // PlayerCsAction enum /* 0x396 */ u8 cueId; // PlayerCueId enum /* 0x397 */ u8 unk_397; // PlayerDoorType enum /* 0x398 */ Actor* csActor; diff --git a/include/z64quake.h b/include/z64quake.h index 0150b5404..e98bfbbac 100644 --- a/include/z64quake.h +++ b/include/z64quake.h @@ -59,7 +59,7 @@ s16 Distortion_GetTimeLeft(void); s16 Distortion_GetType(void); void Distortion_RemoveRequest(s32 type); -void Distortion_Init(PlayState* play); +void Distortion_Init(struct PlayState* play); void Distortion_Update(void); #endif diff --git a/include/z64save.h b/include/z64save.h index 98c558415..d56347ec9 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -5,6 +5,7 @@ #include "PR/os.h" #include "z64item.h" #include "z64math.h" +#include "unk.h" struct GameState; struct PlayState; diff --git a/include/z64transition.h b/include/z64transition.h index fe6027a9f..267098997 100644 --- a/include/z64transition.h +++ b/include/z64transition.h @@ -81,7 +81,7 @@ typedef struct { /* 0x8 */ u16 timer; } TransitionFade; // size = 0xC -#define FBDEMO_CIRCLE_GET_MASK_TYPE(type) (type & 1) +#define FBDEMO_CIRCLE_GET_MASK_TYPE(type) ((type) & 1) typedef struct { /* 0x00 */ Color_RGBA8_u32 color; diff --git a/include/z64visfbuf.h b/include/z64visfbuf.h new file mode 100644 index 000000000..00961b7da --- /dev/null +++ b/include/z64visfbuf.h @@ -0,0 +1,38 @@ +#ifndef Z64_VISFBUF_H +#define Z64_VISFBUF_H + +#include "ultra64.h" +#include "color.h" +#include "PR/gs2dex.h" + +typedef enum VisFbufBgMode { + /* 0 */ VIS_FBUF_BG_CYC_1CYC, //!< Enable rescaling + /* 1 */ VIS_FBUF_BG_CYC_COPY //!< Direct copy, no scaling +} VisFbufBgMode; + +typedef enum VisFbufMode { + /* 0 */ VIS_FBUF_MODE_NONE, //!< Do nothing but waste time loading microcode + /* 1 */ VIS_FBUF_MODE_GENERAL, //!< Interpolation, filling and scaling + /* 2 */ VIS_FBUF_MODE_INTERPOLATE +} VisFbufMode; + +typedef struct VisFbuf { + /* 0x00 */ u8 mode; + /* 0x04 */ f32 scale; + /* 0x08 */ f32 lodProportion; // expected to be between 0.0f and 1.0f + /* 0x0C */ Color_RGBA8_u32 primColor; + /* 0x10 */ Color_RGBA8_u32 envColor; +} VisFbuf; // size = 0x14 + +void VisFbuf_Init(VisFbuf* this); +void VisFbuf_Destroy(VisFbuf* this); +void VisFbuf_DrawBgToColorImage(Gfx** gfxP, uObjBg* bg, void* img, s32 width, s32 height, VisFbufBgMode cycleMode); +void VisFbuf_SetBg(Gfx** gfxP, void* source, void* img, s32 width, s32 height, f32 x, f32 y, f32 scaleX, f32 scaleY, VisFbufBgMode cycleMode); +void VisFbuf_SetBgSimple(Gfx** gfxP, void* source, void* img, s32 width, s32 height, VisFbufBgMode cycleMode); +void VisFbuf_SetBgGeneral(Gfx** gfxP, void* source, void* img, s32 width, s32 height, f32 x, f32 y, f32 scaleX, f32 scaleY, VisFbufBgMode cycleMode); +void VisFbuf_ApplyEffects(VisFbuf* this, Gfx** gfxP, void* source, void* img, s32 width, s32 height); +void VisFbuf_DrawGeneral(VisFbuf* this, Gfx** gfxP, void* source, void* img, s32 width, s32 height); +void VisFbuf_DrawInterpolate(VisFbuf* this, Gfx** gfxP, void* img, s32 width, s32 height); +void VisFbuf_Draw(VisFbuf* this, Gfx** gfxP, void* img); + +#endif diff --git a/spec b/spec index b8d6431f5..310d02547 100644 --- a/spec +++ b/spec @@ -42,21 +42,21 @@ beginseg include "build/src/boot/O2/system_malloc.o" include "build/src/boot/O2/rand.o" include "build/src/boot/O2/__osMalloc.o" - include "build/src/libultra/rmon/sprintf.o" + include "build/src/libultra/libc/sprintf.o" include "build/src/boot/O2/printutils.o" include "build/src/boot/O2/sleep.o" include "build/asm/boot/setcause.text.o" include "build/src/libultra/os/sendmesg.o" include "build/src/libultra/io/pfsfreeblocks.o" - include "build/src/libultra/os/viextend.o" + include "build/src/libultra/io/viextendvstart.o" include "build/src/libultra/os/stopthread.o" include "build/src/libultra/os/recvmesg.o" include "build/asm/boot/setintmask.text.o" include "build/data/boot/setintmask.rodata.o" include "build/asm/boot/getintmask.text.o" include "build/src/libultra/voice/voicesetword.o" - include "build/src/libultra/io/osViModeNtscHpf1.o" - include "build/src/libultra/io/osViModePalLan1.o" + include "build/src/libultra/vimodes/vimodentschpf1.o" + include "build/src/libultra/vimodes/vimodepallan1.o" include "build/asm/boot/guScale.text.o" include "build/src/libultra/gu/sinf.o" include "build/src/libultra/gu/sins.o" @@ -108,11 +108,11 @@ beginseg include "build/src/libultra/os/stoptimer.o" include "build/asm/boot/probetlb.text.o" include "build/src/libultra/io/pimgr.o" - include "build/data/boot/pimgr.data.o" include "build/src/libultra/io/piacs.o" pad_text include "build/src/libultra/io/devmgr.o" include "build/src/libultra/io/pirawdma.o" + include "build/src/libultra/vimodes/vimodentschpn1.o" include "build/src/libultra/io/contpfs.o" include "build/asm/boot/getcount.text.o" pad_text @@ -124,7 +124,7 @@ beginseg include "build/src/libultra/os/afterprenmi.o" include "build/src/libultra/io/contquery.o" include "build/src/libultra/gu/lookathil.o" - include "build/src/libultra/rmon/xprintf.o" + include "build/src/libultra/libc/xprintf.o" include "build/src/libultra/voice/voicecleardictionary.o" include "build/asm/boot/unmaptlball.text.o" include "build/src/libultra/io/epidma.o" @@ -169,8 +169,8 @@ beginseg include "build/src/libultra/io/pfsdeletefile.o" include "build/src/libultra/gu/ortho.o" include "build/asm/boot/interrupt.text.o" - include "build/src/libultra/io/osViModeNtscLan1.o" - include "build/src/libultra/io/osViModeMpalLan1.o" + include "build/src/libultra/vimodes/vimodentsclan1.o" + include "build/src/libultra/vimodes/vimodempallan1.o" include "build/src/libultra/io/vi.o" include "build/src/libultra/io/viswapcontext.o" include "build/src/libultra/io/pigetcmdq.o" @@ -180,12 +180,12 @@ beginseg include "build/src/libultra/gu/coss.o" include "build/src/libultra/os/settime.o" include "build/src/libultra/voice/voicestopread.o" - include "build/src/libultra/gu/visetevent.o" + include "build/src/libultra/io/visetevent.o" include "build/src/libultra/io/pfsisplug.o" include "build/src/libultra/voice/voicegetstatus.o" include "build/src/libultra/io/cartrominit.o" - include "build/src/libultra/gu/guS2DInitBg.o" - include "build/data/boot/guS2DInitBg.data.o" + include "build/src/libultra/gu/us2dex.o" + include "build/src/libultra/vimodes/vimodefpallan1.o" include "build/src/libultra/io/pfsselectbank.o" include "build/src/libultra/io/contsetch.o" include "build/asm/boot/setfpccsr.text.o" @@ -203,10 +203,10 @@ beginseg include "build/src/libultra/io/contramwrite.o" include "build/src/libultra/io/epirawwrite.o" include "build/src/libultra/os/settimer.o" - include "build/data/boot/__libm_qnan_f.rodata.o" - include "build/src/libultra/rmon/xldtob.o" + include "build/data/boot/libm_vals.rodata.o" + include "build/src/libultra/libc/xldtob.o" include "build/src/libultra/libc/ldiv.o" - include "build/src/libultra/rmon/xlitob.o" + include "build/src/libultra/libc/xlitob.o" include "build/src/libultra/io/sirawwrite.o" include "build/src/libultra/io/spgetstat.o" include "build/src/libultra/io/spsetstat.o" @@ -329,12 +329,12 @@ endseg beginseg name "map_i_static" - include "build/assets/archives/map_i_static/map_i_static.yar.o" + include "build/assets/c/archives/map_i_static/map_i_static.yar.o" endseg beginseg name "map_grand_static" - include "build/assets/archives/map_grand_static/map_grand_static.yar.o" + include "build/assets/c/archives/map_grand_static/map_grand_static.yar.o" endseg beginseg @@ -519,7 +519,7 @@ beginseg include "build/src/code/z_view.o" include "build/src/code/z_vimode.o" include "build/src/code/z_viscvg.o" - include "build/src/code/code_80140E80.o" + include "build/src/code/z_visfbuf.o" include "build/src/code/z_vismono.o" include "build/src/code/z_viszbuf.o" include "build/src/code/z_vr_box.o" @@ -3158,8 +3158,7 @@ beginseg name "ovl_fbdemo_wipe4" compress include "build/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.o" - include "build/data/ovl_fbdemo_wipe4/ovl_fbdemo_wipe4.data.o" - include "build/data/ovl_fbdemo_wipe4/ovl_fbdemo_wipe4.reloc.o" + include "build/src/overlays/fbdemos/ovl_fbdemo_wipe4/ovl_fbdemo_wipe4_reloc.o" endseg beginseg diff --git a/src/audio/code_8019AF00.c b/src/audio/code_8019AF00.c index 5fb24860f..3f684cbf9 100644 --- a/src/audio/code_8019AF00.c +++ b/src/audio/code_8019AF00.c @@ -39,7 +39,7 @@ typedef enum { /* 0xD */ SFX_CHANNEL_OCARINA, // SfxOcarinaBank /* 0xE */ SFX_CHANNEL_VOICE0, // SfxVoiceBank /* 0xF */ SFX_CHANNEL_VOICE1 -} SfxChannelIndex; // playerIndex = 2 +} SfxChannelIndex; // seqPlayerIndex = 2 // Global IO ports for sequences, 8 global ports per seqPlayer typedef enum { @@ -72,7 +72,7 @@ void Audio_StartMorningSceneSequence(u16 seqId); void Audio_StartSceneSequence(u16 seqId); void Audio_PlaySequenceWithSeqPlayerIO(s8 seqPlayerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData); void Audio_SetSfxReverbIndexExceptOcarinaBank(u8 reverbIndex); -void func_801A3038(void); +void Audio_MuteBgmPlayersForFanfare(void); void Audio_PlayAmbience(u8 ambienceId); void Audio_SetSfxVolumeExceptSystemAndOcarinaBanks(u8 volume); @@ -82,8 +82,8 @@ void Audio_UpdateObjSoundFanfare(void); void Audio_UpdateSubBgmAtPos(void); void Audio_UpdateSequenceAtPos(void); void Audio_UpdateSceneSequenceResumePoint(void); -void func_801A312C(void); -void func_801A3AC0(void); +void Audio_UpdateFanfare(void); +void Audio_UpdatePauseState(void); void Audio_ResetRequestedSceneSeqId(void); // Sfx bss @@ -107,11 +107,11 @@ f32* sSfxVolumeCur; f32 sSfxVolumeTarget; f32 sSfxVolumeRate; u16 sRequestedSceneSeqId; -SfxChannelState sSfxChannelState[16]; +SfxChannelState sSfxChannelState[SEQ_NUM_CHANNELS]; // Sequence bss -u8 D_801FD3A8; -u8 D_801FD3A9; +u8 sRomaniSingingTimer; +u8 sRomaniSingingDisabled; u8 sRiverSoundBgmTimer; u8 sFanfareState; u16 sFanfareSeqId; @@ -3648,12 +3648,12 @@ void Audio_Update(void) { Audio_StepFreqLerp(&sWaterfallFreqScaleLerp); Audio_UpdateRiverSoundVolumes(); Audio_UpdateSceneSequenceResumePoint(); - func_801A312C(); + Audio_UpdateFanfare(); Audio_UpdateSfxVolumeTransition(); Audio_UpdateSubBgmAtPos(); Audio_UpdateObjSoundFanfare(); Audio_UpdateSequenceAtPos(); - func_801A3AC0(); + Audio_UpdatePauseState(); Audio_UpdateObjSoundProperties(); Audio_ResetRequestedSceneSeqId(); AudioSfx_ProcessRequests(); @@ -5123,7 +5123,7 @@ void Audio_UpdateObjSoundFanfare(void) { Audio_StartObjSoundFanfare(SEQ_PLAYER_FANFARE, &sObjSoundFanfarePos, sObjSoundFanfareSeqId, 0); if (AudioSeq_GetActiveSeqId(SEQ_PLAYER_FANFARE) == NA_BGM_DISABLED) { - func_801A3038(); + Audio_MuteBgmPlayersForFanfare(); } if ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_DISABLED) && @@ -5384,7 +5384,42 @@ void Audio_ClearSariaBgm2(void) { sRiverSoundBgmPos = NULL; } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A246C.s") +void func_801A246C(u8 seqPlayerIndex, u8 type) { + u16 seqId; + u8 targetVolume; + s32 channelMask = 0; + + targetVolume = 0; + + switch (type) { + case 0: + targetVolume = 0x7F; + break; + + case 1: + channelMask = 0xFFFF; + break; + + case 2: + targetVolume = 0xFF; + break; + + default: + break; + } + + if (targetVolume != 0xFF) { + SEQCMD_SET_CHANNEL_DISABLE_MASK(seqPlayerIndex, channelMask); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, targetVolume, 1); + } else { + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, 0x7F, 0); + seqId = AudioSeq_GetActiveSeqId(seqPlayerIndex); + + if (seqId != NA_BGM_DISABLED) { + SEQCMD_PLAY_SEQUENCE(seqPlayerIndex, 0, seqId); + } + } +} void Audio_PlayMorningSceneSequence(u16 seqId, u8 dayMinusOne) { Audio_StartMorningSceneSequence(seqId); @@ -5612,15 +5647,64 @@ void Audio_ForceRestorePreviousBgm(void) { sPrevMainBgmSeqId = NA_BGM_DISABLED; } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3000.s") +void Audio_PlayFanfareWithPlayerIOPort7(u16 seqId, u8 ioData) { + Audio_PlayFanfare(seqId); + SEQCMD_SET_SEQPLAYER_IO(SEQ_PLAYER_FANFARE, 7, ioData); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3038.s") +void Audio_MuteBgmPlayersForFanfare(void) { + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_FANFARE, 0, 5); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_FANFARE, 0, 5); + SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX(SEQ_PLAYER_FANFARE, SEQ_PLAYER_BGM_MAIN, 1, 10); + SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX(SEQ_PLAYER_FANFARE, SEQ_PLAYER_BGM_SUB, 1, 10); + SEQCMD_SETUP_SET_CHANNEL_DISABLE_MASK(SEQ_PLAYER_FANFARE, SEQ_PLAYER_BGM_MAIN, 0); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_PlayFanfare.s") +/** + * Sets up seqId to play on seqPlayerIndex 1 + */ +void Audio_PlayFanfare(u16 seqId) { + u16 prevSeqId = AudioSeq_GetActiveSeqId(SEQ_PLAYER_FANFARE); + u32 outNumFonts; + u8* prevFontId = AudioThread_GetFontsForSequence(prevSeqId & 0xFF, &outNumFonts); + u8* fontId = AudioThread_GetFontsForSequence(seqId & 0xFF, &outNumFonts); -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A312C.s") + if ((prevSeqId == NA_BGM_DISABLED) || (*prevFontId == *fontId)) { + sFanfareState = 1; + } else { + sFanfareState = 5; + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A31EC.s") + sFanfareSeqId = seqId; +} + +void Audio_UpdateFanfare(void) { + if (sFanfareState != 0) { + if ((sFanfareState != 5) && + !AudioSeq_IsSeqCmdNotQueued((SEQCMD_OP_STOP_SEQUENCE << 28) | (SEQ_PLAYER_FANFARE << 24), + SEQCMD_OP_MASK | SEQCMD_ASYNC_ACTIVE | SEQCMD_SEQPLAYER_MASK)) { + sFanfareState = 0; + } else { + sFanfareState--; + if (sFanfareState == 0) { + AUDIOCMD_GLOBAL_POP_PERSISTENT_CACHE(SEQUENCE_TABLE); + AUDIOCMD_GLOBAL_POP_PERSISTENT_CACHE(FONT_TABLE); + AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN); + if (AudioSeq_GetActiveSeqId(SEQ_PLAYER_FANFARE) == NA_BGM_DISABLED) { + Audio_MuteBgmPlayersForFanfare(); + } + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_FANFARE, 0, sFanfareSeqId); + SEQCMD_SET_CHANNEL_DISABLE_MASK(SEQ_PLAYER_BGM_MAIN, 0xFFFF); + } + } + } +} + +void Audio_PlayFanfareWithPlayerIOCustomPort(u16 seqId, s8 ioPort, u8 ioData) { + SEQCMD_SET_SEQPLAYER_IO(SEQ_PLAYER_FANFARE, ioPort, ioData); + Audio_PlayFanfare(seqId); +} void Audio_PlaySequenceWithSeqPlayerIO(s8 seqPlayerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData) { u16 flaggedSeqId; @@ -5743,15 +5827,114 @@ void Audio_UpdateEnemyBgmVolume(f32 dist) { sBgmEnemyDist = dist; } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A36F0.s") +void Audio_UpdateRomaniSinging(f32 dist, u16 seqId) { + s8 pad; + s8 melodyVolume; + s16 curSeqId; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3950.s") + if (sRomaniSingingDisabled) { + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A39F8.s") + curSeqId = (s8)(AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) & 0xFF); -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3A7C.s") + if (curSeqId == (seqId & 0xFF)) { + if ((seqId & 0xFF) == NA_BGM_ROMANI_RANCH) { + // Romani is singing along with the Romani Ranch Sequence -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3AC0.s") + if (dist > 2000.0f) { + melodyVolume = 127; + } else if (dist < 200.0f) { + melodyVolume = 0; + } else { + melodyVolume = (s8)(((dist - 200.0f) * 127.0f) / 1800.0f); + } + + // Update volume for channels 0 & 1, which contains Romani's singing + SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_MAIN, 0, 3, 127 - melodyVolume); + SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_MAIN, 1, 3, 127 - melodyVolume); + + // Update volume for channel 13, which contains the melody line for Romani's Ranch Sequence + SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_MAIN, 13, 3, melodyVolume); + if (sRomaniSingingTimer == 0) { + sRomaniSingingTimer++; + } + } + } else if ((curSeqId == NA_BGM_AMBIENCE) && ((seqId & 0xFF) == NA_BGM_ROMANI_RANCH)) { + // Romani is singing along with ambience + curSeqId = (s8)(AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) & 0xFF); + + if ((curSeqId != (seqId & 0xFF)) && (sRomaniSingingTimer < 10)) { + // Disable all channels between 2-15. + // Only allow the two channels with Romani's singing to play, and surpress the full Romani Ranch sequence. + Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_SUB, NA_BGM_ROMANI_RANCH, 0, 0, 0); + SEQCMD_SET_CHANNEL_DISABLE_MASK(SEQ_PLAYER_BGM_SUB, 0xFFFC); + sRomaniSingingTimer = 10; + } + + if (dist > 2000.0f) { + melodyVolume = 127; + } else if (dist < 200.0f) { + melodyVolume = 0; + } else { + melodyVolume = (s8)(((dist - 200.0f) * 127.0f) / 1800.0f); + } + + // Update volume for channels 0 & 1, which contains Romani's singing + SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_SUB, 0, 3, 127 - melodyVolume); + SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_SUB, 1, 3, 127 - melodyVolume); + } + + if (sRomaniSingingTimer < 10) { + sRomaniSingingTimer++; + } +} + +u8 func_801A3950(u8 seqPlayerIndex, u8 resetChannelIO) { + u8 ret = SEQ_IO_VAL_NONE; + SequenceChannel* channel = gAudioCtx.seqPlayers[seqPlayerIndex].channels[15]; + + if (gAudioCtx.seqPlayers[seqPlayerIndex].enabled && channel->enabled) { + if (channel->seqScriptIO[0] != SEQ_IO_VAL_NONE) { + ret = channel->seqScriptIO[0]; + if (resetChannelIO == true) { + SEQCMD_SET_CHANNEL_IO(seqPlayerIndex, 15, 0, (u8)SEQ_IO_VAL_NONE); + } + } + } + return ret; +} + +// Used only by minifrog +u8 func_801A39F8(void) { + u8 frogIndex = 0xFF; + s32 pad; + SequenceChannel* channel = gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_SUB].channels[15]; + + if (gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_SUB].enabled) { + if ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) == NA_BGM_FROG_SONG) && channel->enabled) { + if (channel->seqScriptIO[0] != -1) { + frogIndex = channel->seqScriptIO[0]; + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_BGM_SUB, 15, 0, SEQ_IO_VAL_NONE); + } + } + } + return frogIndex; +} + +void Audio_SetPauseState(u8 isPauseMenuOpen) { + if ((isPauseMenuOpen == false) && (sAudioPauseState != AUDIO_PAUSE_STATE_CLOSED)) { + sAudioPauseState = AUDIO_PAUSE_STATE_CLOSING; + } else { + sAudioPauseState = isPauseMenuOpen << 1; // Set to AUDIO_PAUSE_STATE_OPEN + } +} + +void Audio_UpdatePauseState(void) { + if ((sAudioPauseState != AUDIO_PAUSE_STATE_CLOSED) && (sAudioPauseState != AUDIO_PAUSE_STATE_OPEN)) { + sAudioPauseState--; // Set to AUDIO_PAUSE_STATE_CLOSED + } +} void Audio_PlaySfx_PauseMenuOpenOrClose(u8 pauseMenuOpenOrClose) { sAudioPauseMenuOpenOrClose = pauseMenuOpenOrClose; @@ -5764,13 +5947,81 @@ void Audio_PlaySfx_PauseMenuOpenOrClose(u8 pauseMenuOpenOrClose) { } } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3B48.s") +// Only used by guru guru +void Audio_MuteSeqPlayerBgmSub(u8 isMuted) { + if (isMuted == true) { + AUDIOCMD_GLOBAL_MUTE(SEQ_PLAYER_BGM_SUB); + } else { + AUDIOCMD_GLOBAL_UNMUTE(SEQ_PLAYER_BGM_SUB, false); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3B90.s") +/** + * Enable or disable Romani's singing + * + * @param romaniSingingDisabled true to disable, false to enable + */ +void Audio_ToggleRomaniSinging(u8 romaniSingingDisabled) { + u8 seqPlayerIndex; + u16 channelMaskDisable; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3CD8.s") + sRomaniSingingDisabled = romaniSingingDisabled; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3CF4.s") + if ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) & 0xFF) == NA_BGM_ROMANI_RANCH) { + // Romani is singing along with the Romani Ranch Sequence + seqPlayerIndex = SEQ_PLAYER_BGM_MAIN; + // Do not disable any channel. + // Allow the full Romani Ranch sequence to play in addition to Romani's singing. + channelMaskDisable = 0; + } else if ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) & 0xFF) == NA_BGM_ROMANI_RANCH) { + seqPlayerIndex = SEQ_PLAYER_BGM_SUB; + // Disable all channels between 2-15. + // Only allow the two channels with Romani's singing to play, and surpress the full Romani sequence. + channelMaskDisable = 0xFFFC; + } else { + return; + } + + if (romaniSingingDisabled) { + // Turn volume off for channels 0 & 1, which contains Romani's singing + SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 0, 1, 0); + SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 1, 1, 0); + if (seqPlayerIndex == SEQ_PLAYER_BGM_SUB) { + // When singing along with ambience, disable all 16 channels + SEQCMD_SET_CHANNEL_DISABLE_MASK(seqPlayerIndex, channelMaskDisable | 3); + } + } else { + if (seqPlayerIndex == SEQ_PLAYER_BGM_SUB) { + // When singing along with ambience, start the sequence + Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_SUB, NA_BGM_ROMANI_RANCH, 0, 0, 0); + } + + // Turn volume on for only channels 0 & 1, which contains Romani's singing + SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 0, 1, 0x7F); + SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 1, 1, 0x7F); + + if (seqPlayerIndex == SEQ_PLAYER_BGM_SUB) { + // When singing along with ambience, disable channels 2-15 + SEQCMD_SET_CHANNEL_DISABLE_MASK(seqPlayerIndex, channelMaskDisable); + } + } +} + +void Audio_SetEnvReverb(s8 reverb) { + sAudioEnvReverb = reverb & 0x7F; +} + +void Audio_SetCodeReverb(s8 reverb) { + u8 reverbIndex; + + if (reverb != 0) { + if ((reverb & 0x40) != (sAudioCodeReverb & 0x40)) { + reverbIndex = (reverb >> 6) + 1; + Audio_SetSfxReverbIndexExceptOcarinaBank(reverbIndex); + } + sAudioCodeReverb = reverb & 0x7F; + } +} /** * Possibly a test for surround sound @@ -5786,11 +6037,62 @@ void Audio_PlaySfx_SurroundSoundTest(void) { Audio_PlaySfx_AtPosWithAllChannelsIO(&gSfxDefaultPos, NA_SE_SY_SOUT_DEMO, val); } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3D98.s") +void Audio_SetFileSelectSettings(s8 audioSetting) { + s8 soundMode; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3E38.s") + switch (audioSetting) { + case SAVE_AUDIO_STEREO: + soundMode = SOUNDMODE_STEREO; + sSoundMode = SOUNDMODE_STEREO; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3EC0.s") + case SAVE_AUDIO_MONO: + soundMode = SOUNDMODE_MONO; + sSoundMode = SOUNDMODE_MONO; + break; + + case SAVE_AUDIO_HEADSET: + soundMode = SOUNDMODE_HEADSET; + sSoundMode = SOUNDMODE_HEADSET; + break; + + case SAVE_AUDIO_SURROUND: + soundMode = SOUNDMODE_SURROUND; + sSoundMode = SOUNDMODE_SURROUND_EXTERNAL; + break; + + default: + break; + } + + SEQCMD_SET_SOUND_MODE(soundMode); +} + +void Audio_SetBaseFilter(u8 filter) { + if (sAudioBaseFilter != filter) { + if (filter == 0) { + AudioSfx_StopById(NA_SE_PL_IN_BUBBLE); + } else if (sAudioBaseFilter == 0) { + AudioSfx_PlaySfx(NA_SE_PL_IN_BUBBLE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + } + } + sAudioBaseFilter = filter; + sAudioBaseFilter2 = filter; +} + +void Audio_SetExtraFilter(u8 filter) { + u8 channelIndex; + + sAudioExtraFilter2 = filter; + sAudioExtraFilter = filter; + if (gActiveSeqs[SEQ_PLAYER_AMBIENCE].seqId == NA_BGM_AMBIENCE) { + for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) { + // seq player 4, all channels, slot 6 + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_AMBIENCE, channelIndex, 6, filter); + } + } +} void Audio_SetCutsceneFlag(s8 flag) { sAudioCutsceneFlag = flag; @@ -5808,17 +6110,67 @@ void Audio_PlaySfx_IfNotInCutscene(u16 sfxId) { } // Unused -void Audio_MuteSfxAndAmbienceSeqExceptOcarinaAndSystem(u8 muteOnlySfxAndAmbienceSeq) { +void Audio_MuteSfxAndAmbienceSeqExceptSystemAndOcarina(u8 muteOnlySfxAndAmbienceSeq) { sMuteOnlySfxAndAmbienceSeq = muteOnlySfxAndAmbienceSeq; } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_SetSpec.s") +void Audio_SetSpec(u8 specId) { + if (!sMuteOnlySfxAndAmbienceSeq) { + SEQCMD_RESET_AUDIO_HEAP(0, 0, specId); + } else { + SEQCMD_RESET_AUDIO_HEAP(2, 0, specId); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4058.s") +void Audio_MuteAllSeqExceptSystemAndOcarina(u16 duration) { + s32 skip; + u8 channelIndex; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A41C8.s") + if (!sMuteOnlySfxAndAmbienceSeq) { + sAllPlayersMutedExceptSystemAndOcarina = true; + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, (duration * 3) / 2); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, (duration * 3) / 2); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_SUB, (duration * 3) / 2); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A41F8.s") + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_AMBIENCE, (duration * 3) / 2); + + for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) { + skip = false; + switch (channelIndex) { + case SFX_CHANNEL_SYSTEM0: + case SFX_CHANNEL_SYSTEM1: + if (gAudioSpecId == 10) {} // Remnant of OoT + if (gAudioSpecId == 11) {} + skip = true; + break; + + case SFX_CHANNEL_OCARINA: + skip = true; + break; + } + + if (!skip) { + SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_SFX, channelIndex, (u8)(duration >> 1), 0); + } + } +} + +void Audio_MuteSfxAndAmbienceSeqExceptSysAndOca(u16 duration) { + sMuteOnlySfxAndAmbienceSeq = true; + Audio_MuteAllSeqExceptSystemAndOcarina(duration); +} + +void Audio_StopFanfare(u16 duration) { + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, duration); + if (AudioSeq_GetActiveSeqId(SEQ_PLAYER_FANFARE) != NA_BGM_DISABLED) { + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, duration); + } + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_SUB, duration); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_AMBIENCE, duration); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, 0x7F, 0); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_FANFARE, 0x7F, 0); +} /** * The flag 0xFF makes the sequence process SkipTicks and SkipForwardSequence @@ -5828,11 +6180,31 @@ void Audio_StartSfxPlayer(void) { AudioSeq_StartSequence(SEQ_PLAYER_SFX, NA_BGM_GENERAL_SFX, 0xFF, 5); } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A42C8.s") +void Audio_DisableAllSeq(void) { + AUDIOCMD_GLOBAL_DISABLE_SEQPLAYER(SEQ_PLAYER_BGM_MAIN, 0); + AUDIOCMD_GLOBAL_DISABLE_SEQPLAYER(SEQ_PLAYER_FANFARE, 0); + AUDIOCMD_GLOBAL_DISABLE_SEQPLAYER(SEQ_PLAYER_SFX, 0); + AUDIOCMD_GLOBAL_DISABLE_SEQPLAYER(SEQ_PLAYER_BGM_SUB, 0); + AUDIOCMD_GLOBAL_DISABLE_SEQPLAYER(SEQ_PLAYER_AMBIENCE, 0); + AudioThread_ScheduleProcessCmds(); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4324.s") +s8 Audio_GetEnabledNotesCount(void) { + return AudioThread_GetEnabledNotesCount(); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4348.s") +// Unused +void func_801A4348(void) { + Audio_DisableAllSeq(); + AudioThread_ScheduleProcessCmds(); + + // Wait for all notes to be finished + while (true) { + if (Audio_GetEnabledNotesCount() == 0) { + break; + } + } +} void Audio_SetSfxVolumeExceptSystemAndOcarinaBanks(u8 volume) { u8 channelIndex; @@ -5863,16 +6235,85 @@ void Audio_SetSfxReverbIndexExceptOcarinaBank(u8 reverbIndex) { } } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_PreNMI.s") +void Audio_PreNMI(void) { + AudioThread_PreNMIInternal(); +} void Audio_ResetRequestedSceneSeqId(void) { sRequestedSceneSeqId = NA_BGM_DISABLED; } -void Audio_ResetData(void); -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_ResetData.s") +void Audio_ResetData(void) { + u8 i; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A46F8.s") + for (i = 0; i < ARRAY_COUNT(sSfxSettings); i++) { + sSfxSettings[i].pos = NULL; + sSfxSettings[i].freqScale = 1.0; + sSfxSettings[i].reverbAdd = 0; + } + sSfxSettingsFlags = 0; + sTwoSemitonesLoweredFreq = 0.9f; + sSfxIncreasedReverb = 20; + sSfxVolumeDuration = 0; + sPrevSeqMode = 0; + sSfxSyncedVolume = 1.0f; + sSfxSyncedFreq = 1.0f; + sAudioBaseFilter = 0; + sAudioExtraFilter = 0; + sAudioBaseFilter2 = 0; + sAudioExtraFilter2 = 0; + AudioOcarina_ResetInstrument(); + sRiverFreqScaleLerp.remainingFrames = 0; + sWaterfallFreqScaleLerp.remainingFrames = 0; + sRiverFreqScaleLerp.value = 1; + sWaterfallFreqScaleLerp.value = 1; + sSfxAdjustedFreq = 1; + sRiverSoundMainBgmVol = 0x7F; + sRiverSoundMainBgmCurrentVol = 0x7F; + sRiverSoundMainBgmLower = false; + sRiverSoundMainBgmRestore = false; + sGanonsTowerVol = 0xFF; + sRomaniSingingTimer = 0; + sObjSoundFanfareRequested = false; + sSpecReverb = sSpecReverbs[gAudioSpecId]; + sAudioPauseMenuOpenOrClose = SFX_PAUSE_MENU_CLOSE; + sPrevMainBgmSeqId = NA_BGM_DISABLED; + AUDIOCMD_SEQPLAYER_SET_IO(SEQ_PLAYER_BGM_MAIN, 0, SEQ_IO_VAL_NONE); + sRiverSoundBgmPos = NULL; + sFanfareState = 0; + sRiverSoundBgmTimer = 1; + sRomaniSingingDisabled = false; + sObjSoundMainBgmSeqId = NA_BGM_GENERAL_SFX; + sPrevAmbienceSeqId = NA_BGM_DISABLED; + sSpatialSeqFlags = 0; + D_801FD432 = 0; + sSpatialSeqSeqId = NA_BGM_GENERAL_SFX; + sSpatialSubBgmFadeTimer = 0; + D_801FD434 = 0; + sSpatialSeqFadeTimer = 0; + sAllPlayersMutedExceptSystemAndOcarina = false; + sAudioPauseState = AUDIO_PAUSE_STATE_CLOSED; + sObjSoundPlayerIndex = SEQ_PLAYER_INVALID; + sIsFinalHoursOrSoaring = false; + + for (i = SEQ_PLAYER_BGM_MAIN; i <= SEQ_PLAYER_BGM_SUB; i++) { + sSpatialSeqIsActive[i] = false; + } +} + +s32 func_801A46F8(void) { + switch (func_801A3950(SEQ_PLAYER_FANFARE, true)) { + case 0: + case 0x8: + case 0x10: + case 0x18: + case 0x20: + return true; + + default: + return false; + } +} // used for z_obj_sound and z_en_gk void Audio_PlaySfx_AtFixedPos(Vec3f* pos, u16 sfxId) { @@ -5908,7 +6349,7 @@ void Audio_SetAmbienceChannelIO(u8 channelIndexRange, u8 ioPort, u8 ioData) { // channelIndexRange = 01 on ioPort 1 if ((((channelIndexRange << 8) + (u32)ioPort) == ((1 << 8) | (u32)1)) && (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) != NA_BGM_ROMANI_RANCH)) { - D_801FD3A8 = 0; + sRomaniSingingTimer = 0; } firstChannelIndex = channelIndexRange >> 4; diff --git a/src/audio/lib/aisetnextbuf.c b/src/audio/lib/aisetnextbuf.c index c3434b19a..57f8ade57 100644 --- a/src/audio/lib/aisetnextbuf.c +++ b/src/audio/lib/aisetnextbuf.c @@ -18,15 +18,15 @@ s32 osAiSetNextBuffer(void* buf, u32 size) { } // Originally a call to __osAiDeviceBusy - status = HW_REG(AI_STATUS_REG, s32); + status = IO_READ(AI_STATUS_REG); if (status & AI_STATUS_FIFO_FULL) { return -1; } // OS_K0_TO_PHYSICAL replaces osVirtualToPhysical, this replacement // assumes that only KSEG0 addresses are given - HW_REG(AI_DRAM_ADDR_REG, u32) = OS_K0_TO_PHYSICAL(bufAdjusted); - HW_REG(AI_LEN_REG, u32) = size; + IO_WRITE(AI_DRAM_ADDR_REG, OS_K0_TO_PHYSICAL(bufAdjusted)); + IO_WRITE(AI_LEN_REG, size); return 0; } diff --git a/src/boot/fault.c b/src/boot/fault.c index 26b579850..0ee4faed7 100644 --- a/src/boot/fault.c +++ b/src/boot/fault.c @@ -42,12 +42,15 @@ #include "fault_internal.h" #include "fault.h" +#include "prevent_bss_reordering.h" #include "prevent_bss_reordering2.h" -#include "global.h" #include "vt.h" #include "PR/osint.h" #include "stackcheck.h" #include "z64thread.h" +#include "main.h" +#include "macros.h" +#include "global.h" FaultMgr* sFaultInstance; f32 sFaultTimeTotal; // read but not set anywhere diff --git a/src/code/code_80140E80.c b/src/code/code_80140E80.c deleted file mode 100644 index 56fcb663c..000000000 --- a/src/code/code_80140E80.c +++ /dev/null @@ -1,21 +0,0 @@ -#include "global.h" - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_80140E80.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_80140EA0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_80140EAC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_80141008.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_8014116C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_801411B4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_80141200.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_8014151C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_80141678.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80140E80/func_80141778.s") diff --git a/src/code/sched.c b/src/code/sched.c index 289b4a696..f16880b61 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -74,14 +74,14 @@ void Sched_HandleAudioCancel(SchedContext* sched) { osSyncPrintf("AUDIO SP キャンセルします\n"); if ((sched->curRSPTask != NULL) && (sched->curRSPTask->list.t.type == M_AUDTASK)) { - if (!(HW_REG(SP_STATUS_REG, u32) & SP_STATUS_HALT)) { + if (!(IO_READ(SP_STATUS_REG) & SP_STATUS_HALT)) { // Attempts to stop AUDIO SP osSyncPrintf("AUDIO SP止めようとします\n"); - HW_REG(SP_STATUS_REG, u32) = SP_SET_HALT; + IO_WRITE(SP_STATUS_REG, SP_SET_HALT); i = 0; - while (!(HW_REG(SP_STATUS_REG, u32) & SP_STATUS_HALT)) { + while (!(IO_READ(SP_STATUS_REG) & SP_STATUS_HALT)) { if (i++ > 100) { // AUDIO SP did not stop (10ms timeout) osSyncPrintf("AUDIO SP止まりませんでした(10msタイムアウト)\n"); @@ -136,14 +136,14 @@ void Sched_HandleGfxCancel(SchedContext* sched) { osSyncPrintf("GRAPH SP キャンセルします\n"); if ((sched->curRSPTask != NULL) && (sched->curRSPTask->list.t.type == M_GFXTASK)) { - if (!(HW_REG(SP_STATUS_REG, u32) & SP_STATUS_HALT)) { + if (!(IO_READ(SP_STATUS_REG) & SP_STATUS_HALT)) { // GRAPH SP tries to stop osSyncPrintf("GRAPH SP止めようとします\n"); - HW_REG(SP_STATUS_REG, u32) = SP_SET_HALT; + IO_WRITE(SP_STATUS_REG, SP_SET_HALT); i = 0; - while (!(HW_REG(SP_STATUS_REG, u32) & SP_STATUS_HALT)) { + while (!(IO_READ(SP_STATUS_REG) & SP_STATUS_HALT)) { if (i++ > 100) { // GRAPH SP did not stop (10ms timeout) osSyncPrintf("GRAPH SP止まりませんでした(10msタイムアウト)\n"); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index b48484687..d7d28dd91 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -4,12 +4,14 @@ */ #include "z64actor.h" +#include "prevent_bss_reordering.h" #include "fault.h" #include "sys_cfb.h" #include "loadfragment.h" #include "z64horse.h" #include "z64quake.h" #include "z64rumble.h" + #include "overlays/actors/ovl_En_Horse/z_en_horse.h" #include "overlays/actors/ovl_En_Part/z_en_part.h" #include "overlays/actors/ovl_En_Box/z_en_box.h" @@ -1096,7 +1098,7 @@ void Actor_SetScale(Actor* actor, f32 scale) { } void Actor_SetObjectDependency(PlayState* play, Actor* actor) { - gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[actor->objectSlot].segment); + gSegments[0x06] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[actor->objectSlot].segment); } void Actor_Init(Actor* actor, PlayState* play) { @@ -1393,31 +1395,31 @@ void Actor_MountHorse(PlayState* play, Player* player, Actor* horse) { s32 func_800B7200(Player* player) { return (player->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_20000000)) || - (player->csMode != PLAYER_CSMODE_NONE); + (player->csAction != PLAYER_CSACTION_NONE); } void Actor_SpawnHorse(PlayState* play, Player* player) { Horse_Spawn(play, player); } -s32 func_800B724C(PlayState* play, Actor* actor, u8 csMode) { +s32 func_800B724C(PlayState* play, Actor* actor, u8 csAction) { Player* player = GET_PLAYER(play); - if ((player->csMode == PLAYER_CSMODE_5) || - ((csMode == PLAYER_CSMODE_END) && (player->csMode == PLAYER_CSMODE_NONE))) { + if ((player->csAction == PLAYER_CSACTION_5) || + ((csAction == PLAYER_CSACTION_END) && (player->csAction == PLAYER_CSACTION_NONE))) { return false; } - player->csMode = csMode; + player->csAction = csAction; player->csActor = actor; player->unk_3BA = false; return true; } -s32 func_800B7298(PlayState* play, Actor* actor, u8 csMode) { +s32 func_800B7298(PlayState* play, Actor* actor, u8 csAction) { Player* player = GET_PLAYER(play); - if (func_800B724C(play, actor, csMode)) { + if (func_800B724C(play, actor, csAction)) { player->unk_3BA = true; return true; } @@ -1939,8 +1941,8 @@ s32 Actor_ProcessTalkRequest(Actor* actor, GameState* gameState) { * - Positive values (`PLAYER_IA_NONE < exchangeItemAction < PLAYER_IA_MAX`): * Offers the ability to initiate the conversation with an item from the player. * Not all positive values are implemented properly for this to work. - * Working ones are PLAYER_IA_PICTO_BOX and PLAYER_IA_BOTTLE_MIN <= exchangeItemAction < PLAYER_IA_MASK_MIN - * Note: While PLAYER_IA_BEANS works, it is special cased to just plant the bean with no talking. + * Working ones are PLAYER_IA_PICTOGRAPH_BOX and PLAYER_IA_BOTTLE_MIN <= exchangeItemAction < PLAYER_IA_MASK_MIN + * Note: While PLAYER_IA_MAGIC_BEANS works, it is special cased to just plant the bean with no talking. * - `PLAYER_IA_NONE`: * Allows the player to speak to or check the actor (by pressing A). * - `PLAYER_IA_MINUS1`: diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 2bef40dce..d16102567 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "fault.h" #include "fixed_point.h" @@ -3956,7 +3957,7 @@ s32 BgCheck_SphVsFirstDynaPoly(CollisionContext* colCtx, u16 xpFlags, CollisionP } /** - * SEGMENTED_TO_VIRTUAL CollisionHeader members + * SEGMENTED_TO_K0 CollisionHeader members */ void CollisionHeader_SegmentedToVirtual(CollisionHeader* colHeader) { colHeader->vtxList = Lib_SegmentedToVirtual(colHeader->vtxList); diff --git a/src/code/z_camera.c b/src/code/z_camera.c index d019ee395..56c6baf15 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -43,7 +43,6 @@ * */ -#include "prevent_bss_reordering.h" #include "global.h" #include "libc/string.h" #include "z64quake.h" diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 39b57cbd0..af1f4ad6c 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "z64collision_check.h" diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 300a3c20f..fa0419de4 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,3 +1,6 @@ +#include "prevent_bss_reordering.h" +#include "prevent_bss_reordering2.h" + #include "PR/ultratypes.h" // Variables are put before most headers as a hacky way to bypass bss reordering @@ -8,19 +11,9 @@ struct CutsceneCamera sCutsceneCameraInfo; u16 sCueTypeList[10]; u8 D_801F4DDC; static s16 sBssPad; -u8 gDisablePlayerCsModeStartPos; +u8 gDisablePlayerCsActionStartPos; s16 gDungeonBossWarpSceneId; -#include "prevent_bss_reordering.h" -#include "prevent_bss_reordering2.h" -// clang-format off -// Partial structs taken from "prevent_bss_reordering.h" -struct Dummy200 { int x; }; -struct Dummy201 { int x; }; -struct Dummy202 { int x; }; -// clang-format on - -#include "global.h" #include "z64quake.h" #include "z64rumble.h" #include "z64shrink_window.h" @@ -54,7 +47,7 @@ void Cutscene_InitContext(PlayState* play, CutsceneContext* csCtx) { sCueTypeList[i] = 0; } - gDisablePlayerCsModeStartPos = false; + gDisablePlayerCsActionStartPos = false; Audio_SetCutsceneFlag(false); } @@ -346,12 +339,12 @@ void CutsceneCmd_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdMisc* cmd) { gSaveContext.save.playerForm = sCutsceneStoredPlayerForm; break; - case CS_MISC_DISABLE_PLAYER_CSMODE_START_POS: - gDisablePlayerCsModeStartPos = true; + case CS_MISC_DISABLE_PLAYER_CSACTION_START_POS: + gDisablePlayerCsActionStartPos = true; break; - case CS_MISC_ENABLE_PLAYER_CSMODE_START_POS: - gDisablePlayerCsModeStartPos = false; + case CS_MISC_ENABLE_PLAYER_CSACTION_START_POS: + gDisablePlayerCsActionStartPos = false; break; case CS_MISC_SAVE_ENTER_CLOCK_TOWN: diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 245f90a82..4ee741801 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -50,7 +50,7 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, TexturePtr texture) { SkinMatrix_SetScale(&mfScale, scale, scale, scale); SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); - gSegments[0x06] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[0x06] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); diff --git a/src/code/z_en_hy_code.c b/src/code/z_en_hy_code.c index c7d89137b..3ca6b175d 100644 --- a/src/code/z_en_hy_code.c +++ b/src/code/z_en_hy_code.c @@ -133,7 +133,7 @@ EnDoor* EnHy_FindNearestDoor(Actor* actor, PlayState* play) { } void EnHy_ChangeObjectAndAnim(EnHy* enHy, PlayState* play, s16 animIndex) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[enHy->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[enHy->animObjectSlot].segment); EnHy_ChangeAnim(&enHy->skelAnime, animIndex); } @@ -141,7 +141,7 @@ s32 EnHy_UpdateSkelAnime(EnHy* enHy, PlayState* play) { s32 isUpdated = false; if (enHy->actor.draw != NULL) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[enHy->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[enHy->animObjectSlot].segment); SkelAnime_Update(&enHy->skelAnime); isUpdated = true; } @@ -168,7 +168,7 @@ s32 EnHy_Init(EnHy* enHy, PlayState* play, FlexSkeletonHeader* skeletonHeaderSeg enHy->actor.objectSlot = enHy->skelLowerObjectSlot; isInitialized = true; ActorShape_Init(&enHy->actor.shape, 0.0f, NULL, 0.0f); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[enHy->actor.objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[enHy->actor.objectSlot].segment); SkelAnime_InitFlex(play, &enHy->skelAnime, skeletonHeaderSeg, NULL, enHy->jointTable, enHy->morphTable, ENHY_LIMB_MAX); EnHy_ChangeObjectAndAnim(enHy, play, animIndex); diff --git a/src/code/z_eventmgr.c b/src/code/z_eventmgr.c index fed5ec48c..9f08806f9 100644 --- a/src/code/z_eventmgr.c +++ b/src/code/z_eventmgr.c @@ -213,7 +213,7 @@ void CutsceneManager_End(void) { sCutsceneMgr.targetActor->flags &= ~ACTOR_FLAG_100000; // fallthrough case CS_START_1: - func_800B7298(sCutsceneMgr.play, NULL, PLAYER_CSMODE_END); + func_800B7298(sCutsceneMgr.play, NULL, PLAYER_CSACTION_END); sCutsceneMgr.startMethod = CS_START_0; break; @@ -338,13 +338,13 @@ s16 CutsceneManager_IsNext(s16 csId) { } /** - * Start an actor cutscene, activate Player Cutscene Mode "Wait" + * Start an actor cutscene, activate Player Cutscene Action "Wait" */ s16 CutsceneManager_StartWithPlayerCs(s16 csId, Actor* actor) { s16 startCsId = CutsceneManager_Start(csId, actor); if (startCsId >= 0) { - func_800B7298(sCutsceneMgr.play, NULL, PLAYER_CSMODE_WAIT); + func_800B7298(sCutsceneMgr.play, NULL, PLAYER_CSACTION_WAIT); if (sCutsceneMgr.length == 0) { CutsceneManager_Stop(sCutsceneMgr.csId); } @@ -354,13 +354,13 @@ s16 CutsceneManager_StartWithPlayerCs(s16 csId, Actor* actor) { } /** - * Start an actor cutscene, activate Player Cutscene Mode "Wait", turn on ACTOR_FLAG_100000 + * Start an actor cutscene, activate Player Cutscene Action "Wait", turn on ACTOR_FLAG_100000 */ s16 CutsceneManager_StartWithPlayerCsAndSetFlag(s16 csId, Actor* actor) { s16 startCsId = CutsceneManager_Start(csId, actor); if (startCsId >= 0) { - func_800B7298(sCutsceneMgr.play, NULL, PLAYER_CSMODE_WAIT); + func_800B7298(sCutsceneMgr.play, NULL, PLAYER_CSACTION_WAIT); if (sCutsceneMgr.length == 0) { CutsceneManager_Stop(sCutsceneMgr.csId); } diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 1b3aa49d7..277fc5360 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -106,7 +106,7 @@ void KaleidoSetup_Update(PlayState* play) { func_800F4A10(play); // Set next page mode to scroll left pauseCtx->nextPageMode = pauseCtx->pageIndex * 2 + 1; - func_801A3A7C(1); + Audio_SetPauseState(true); } if (pauseCtx->state == PAUSE_STATE_OPENING_0) { diff --git a/src/code/z_lib.c b/src/code/z_lib.c index a68d7c882..c520b00d5 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -699,14 +699,14 @@ void Lib_Nop801004FC(void) { } void* Lib_SegmentedToVirtual(void* ptr) { - return SEGMENTED_TO_VIRTUAL(ptr); + return SEGMENTED_TO_K0(ptr); } void* Lib_SegmentedToVirtualNull(void* ptr) { if (((uintptr_t)ptr >> 28) == 0) { return ptr; } else { - return SEGMENTED_TO_VIRTUAL(ptr); + return SEGMENTED_TO_K0(ptr); } } @@ -719,7 +719,7 @@ void* Lib_VirtualToPhysical(void* ptr) { if (ptr == NULL) { return NULL; } else { - return (void*)VIRTUAL_TO_PHYSICAL(ptr); + return (void*)OS_K0_TO_PHYSICAL(ptr); } } @@ -732,6 +732,6 @@ void* Lib_PhysicalToVirtual(void* ptr) { if (ptr == NULL) { return NULL; } else { - return (void*)PHYSICAL_TO_VIRTUAL(ptr); + return OS_PHYSICAL_TO_K0(ptr); } } diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index 5d1299bbf..d9abe151d 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #include "interface/parameter_static/parameter_static.h" diff --git a/src/code/z_message.c b/src/code/z_message.c index 3fb8f5bac..4bc104fec 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -4556,8 +4556,8 @@ void Message_DrawMain(PlayState* play, Gfx** gfxP) { AudioOcarina_SetInstrument(sPlayerFormOcarinaInstruments[CUR_FORM]); AudioOcarina_SetPlaybackSong((u8)msgCtx->songPlayed + 1, 1); if (msgCtx->songPlayed != OCARINA_SONG_SCARECROW_SPAWN) { - func_801A3000((u16)sOcarinaSongFanfares[msgCtx->songPlayed], - (u8)sOcarinaSongFanfareIoData[CUR_FORM]); + Audio_PlayFanfareWithPlayerIOPort7((u16)sOcarinaSongFanfares[msgCtx->songPlayed], + (u8)sOcarinaSongFanfareIoData[CUR_FORM]); AudioSfx_MuteBanks(0x20); } } @@ -5107,6 +5107,7 @@ void Message_Draw(PlayState* play) { GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); + polyOpa = POLY_OPA_DISP; nextDisplayList = Graph_GfxPlusOne(polyOpa); gSPDisplayList(OVERLAY_DISP++, nextDisplayList); @@ -5118,6 +5119,7 @@ void Message_Draw(PlayState* play) { gSPEndDisplayList(nextDisplayList++); Graph_BranchDlist(polyOpa, nextDisplayList); POLY_OPA_DISP = nextDisplayList; + CLOSE_DISPS(gfxCtx); } diff --git a/src/code/z_play.c b/src/code/z_play.c index 5d9b2c048..783b73de2 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -3,6 +3,7 @@ #include "regs.h" #include "functions.h" #include "z64vismono.h" +#include "z64visfbuf.h" // Variables are put before most headers as a hacky way to bypass bss reordering s16 sTransitionFillTimer; @@ -11,8 +12,8 @@ TransitionTile sTransitionTile; s32 gTransitionTileState; VisMono sPlayVisMono; Color_RGBA8_u32 gVisMonoColor; -Struct_80140E80 D_801F6D38; -Struct_80140E80* D_801F6D4C; +VisFbuf sPlayVisFbuf; +VisFbuf* sPlayVisFbufInstance; BombersNotebook sBombersNotebook; u8 sBombersNotebookOpen; u8 sMotionBlurStatus; @@ -417,8 +418,8 @@ void Play_Destroy(GameState* thisx) { ShrinkWindow_Destroy(); TransitionFade_Destroy(&this->unk_18E48); VisMono_Destroy(&sPlayVisMono); - func_80140EA0(D_801F6D4C); - D_801F6D4C = NULL; + VisFbuf_Destroy(sPlayVisFbufInstance); + sPlayVisFbufInstance = NULL; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_92_80)) { Actor_CleanupContext(&this->actorCtx, this); @@ -524,7 +525,7 @@ void Play_UpdateWaterCamera(PlayState* this, Camera* camera) { Distortion_SetDuration(80); } - func_801A3EC0(0x20); + Audio_SetExtraFilter(0x20); Environment_EnableUnderwaterLights(this, lightIndex); if ((sQuakeIndex == -1) || (Quake_GetTimeLeft(sQuakeIndex) == 10)) { @@ -555,7 +556,7 @@ void Play_UpdateWaterCamera(PlayState* this, Camera* camera) { Quake_RemoveRequest(sQuakeIndex); } Environment_DisableUnderwaterLights(this); - func_801A3EC0(0); + Audio_SetExtraFilter(0); } } @@ -588,20 +589,20 @@ void Play_UpdateTransition(PlayState* this) { !CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE))) && (!Environment_IsFinalHours(this) || (Entrance_GetSceneId(this->nextEntrance + sceneLayer) < 0) || (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_FINAL_HOURS))) { - func_801A4058(20); + Audio_MuteAllSeqExceptSystemAndOcarina(20); gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; } if (Environment_IsForcedSequenceDisabled()) { - func_801A4058(20); + Audio_MuteAllSeqExceptSystemAndOcarina(20); gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; } if (Environment_IsFinalHours(this) && (Entrance_GetSceneId(this->nextEntrance + sceneLayer) >= 0) && (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS)) { - func_801A41C8(20); + Audio_MuteSfxAndAmbienceSeqExceptSysAndOca(20); } } @@ -922,9 +923,9 @@ void Play_UpdateMain(PlayState* this) { u8 freezeFlashTimer; s32 sp5C = false; - gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); - gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); - gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment); + gSegments[4] = OS_K0_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); + gSegments[5] = OS_K0_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); + gSegments[2] = OS_K0_TO_PHYSICAL(this->sceneSegment); if (R_PICTO_PHOTO_STATE == PICTO_PHOTO_STATE_PROCESS) { R_PICTO_PHOTO_STATE = PICTO_PHOTO_STATE_READY; @@ -1110,7 +1111,7 @@ void Play_PostWorldDraw(PlayState* this) { Gfx* opa; GraphicsContext* gfxCtx = this->state.gfxCtx; - D_801F6D4C->scale = gSaveContext.screenScale / 1000.0f; + sPlayVisFbufInstance->scale = gSaveContext.screenScale / 1000.0f; OPEN_DISPS(gfxCtx); @@ -1118,7 +1119,7 @@ void Play_PostWorldDraw(PlayState* this) { nextOpa = Graph_GfxPlusOne(opa); gSPDisplayList(OVERLAY_DISP++, nextOpa); - func_80141778(D_801F6D4C, &nextOpa, this->unk_18E60, gfxCtx); + VisFbuf_Draw(sPlayVisFbufInstance, &nextOpa, this->unk_18E60); gSPEndDisplayList(nextOpa++); Graph_BranchDlist(opa, nextOpa); @@ -1154,9 +1155,9 @@ void Play_DrawMain(PlayState* this) { OPEN_DISPS(gfxCtx); - gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); - gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); - gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment); + gSegments[4] = OS_K0_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); + gSegments[5] = OS_K0_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); + gSegments[2] = OS_K0_TO_PHYSICAL(this->sceneSegment); gSPSegment(POLY_OPA_DISP++, 0x04, this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); gSPSegment(POLY_XLU_DISP++, 0x04, this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); @@ -1604,7 +1605,7 @@ void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn) { this->sceneConfig = scene->drawConfig; this->sceneSegment = Play_LoadFile(this, &scene->segment); scene->unk_D = 0; - gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment); + gSegments[2] = OS_K0_TO_PHYSICAL(this->sceneSegment); Play_InitScene(this, spawn); Room_AllocateAndLoad(this, &this->roomCtx); } @@ -2174,7 +2175,7 @@ void Play_Init(GameState* thisx) { KaleidoManager_Init(this); ShrinkWindow_Init(); View_Init(&this->view, gfxCtx); - func_801A3EC0(0); + Audio_SetExtraFilter(0); Quake_Init(); Distortion_Init(this); @@ -2311,18 +2312,18 @@ void Play_Init(GameState* thisx) { VisMono_Init(&sPlayVisMono); gVisMonoColor.a = 0; - D_801F6D4C = &D_801F6D38; - func_80140E80(D_801F6D4C); - D_801F6D4C->lodProportion = 0.0f; - D_801F6D4C->mode = 1; - D_801F6D4C->primColor.r = 0; - D_801F6D4C->primColor.g = 0; - D_801F6D4C->primColor.b = 0; - D_801F6D4C->primColor.a = 0; - D_801F6D4C->envColor.r = 0; - D_801F6D4C->envColor.g = 0; - D_801F6D4C->envColor.b = 0; - D_801F6D4C->envColor.a = 0; + sPlayVisFbufInstance = &sPlayVisFbuf; + VisFbuf_Init(sPlayVisFbufInstance); + sPlayVisFbufInstance->lodProportion = 0.0f; + sPlayVisFbufInstance->mode = VIS_FBUF_MODE_GENERAL; + sPlayVisFbufInstance->primColor.r = 0; + sPlayVisFbufInstance->primColor.g = 0; + sPlayVisFbufInstance->primColor.b = 0; + sPlayVisFbufInstance->primColor.a = 0; + sPlayVisFbufInstance->envColor.r = 0; + sPlayVisFbufInstance->envColor.g = 0; + sPlayVisFbufInstance->envColor.b = 0; + sPlayVisFbufInstance->envColor.a = 0; CutsceneFlags_UnsetAll(this); THA_GetRemaining(&this->state.tha); zAllocSize = THA_GetRemaining(&this->state.tha); diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 6c33a5565..43b1cd05d 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -495,7 +495,7 @@ void func_80123140(PlayState* play, Player* player) { s32 Player_InBlockingCsMode(PlayState* play, Player* player) { return (player->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_20000000)) || - (player->csMode != PLAYER_CSMODE_NONE) || (play->transitionTrigger == TRANS_TRIGGER_START) || + (player->csAction != PLAYER_CSACTION_NONE) || (play->transitionTrigger == TRANS_TRIGGER_START) || (play->transitionMode != TRANS_MODE_OFF) || (player->stateFlags1 & PLAYER_STATE1_1) || (player->stateFlags3 & PLAYER_STATE3_80) || (play->actorCtx.unk268 != 0); } @@ -1297,9 +1297,9 @@ void func_80123C58(Player* player) { } void Player_SetEquipmentData(PlayState* play, Player* player) { - if (player->csMode != PLAYER_CSMODE_134) { + if (player->csAction != PLAYER_CSACTION_134) { player->currentShield = GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD); - if ((player->transformation != PLAYER_FORM_ZORA) || (((player->currentBoots != PLAYER_BOOTS_ZORA_LAND)) && + if ((player->transformation != PLAYER_FORM_ZORA) || ((player->currentBoots != PLAYER_BOOTS_ZORA_LAND) && (player->currentBoots != PLAYER_BOOTS_ZORA_UNDERWATER))) { player->currentBoots = D_801BFF90[player->transformation]; } @@ -2590,7 +2590,7 @@ void Player_DrawGetItemImpl(PlayState* play, Player* player, Vec3f* refPos, s32 OPEN_DISPS(play->state.gfxCtx); - gSegments[6] = VIRTUAL_TO_PHYSICAL(player->giObjectSegment); + gSegments[6] = OS_K0_TO_PHYSICAL(player->giObjectSegment); gSPSegment(POLY_OPA_DISP++, 0x06, player->giObjectSegment); gSPSegment(POLY_XLU_DISP++, 0x06, player->giObjectSegment); @@ -2852,7 +2852,7 @@ void func_80127488(PlayState* play, Player* player, u8 alpha) { } void Player_DrawCouplesMask(PlayState* play, Player* player) { - gSegments[0xA] = VIRTUAL_TO_PHYSICAL(player->maskObjectSegment); + gSegments[0xA] = OS_K0_TO_PHYSICAL(player->maskObjectSegment); AnimatedMat_DrawOpa(play, Lib_SegmentedToVirtual(&object_mask_meoto_Matanimheader_001CD8)); } @@ -2884,7 +2884,7 @@ void Player_DrawCircusLeadersMask(PlayState* play, Player* player) { Matrix_Scale(scaleXZ, scaleY, scaleXZ, MTXMODE_APPLY); gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(&gfx[1], 0x08, VIRTUAL_TO_PHYSICAL(SEGMENTED_TO_VIRTUAL(gEffBubble1Tex))); + gSPSegment(&gfx[1], 0x08, OS_K0_TO_PHYSICAL(SEGMENTED_TO_K0(gEffBubble1Tex))); gDPSetPrimColor(&gfx[2], 0, 0, 255, 255, 255, 255); gDPSetEnvColor(&gfx[3], 150, 150, 150, 0); gSPDisplayList(&gfx[4], gEffBubbleDL); @@ -2940,7 +2940,7 @@ void Player_DrawBlastMask(PlayState* play, Player* player) { if (player->blastMaskTimer != 0) { s32 alpha; - gSegments[0xA] = VIRTUAL_TO_PHYSICAL(player->maskObjectSegment); + gSegments[0xA] = OS_K0_TO_PHYSICAL(player->maskObjectSegment); AnimatedMat_DrawOpa(play, Lib_SegmentedToVirtual(&object_mask_bakuretu_Matanimheader_0011F8)); diff --git a/src/code/z_room.c b/src/code/z_room.c index 428dd5c13..758bfaa38 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -574,7 +574,7 @@ s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) { if (osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK) == 0) { roomCtx->status = 0; roomCtx->curRoom.segment = roomCtx->activeRoomVram; - gSegments[3] = VIRTUAL_TO_PHYSICAL(roomCtx->activeRoomVram); + gSegments[3] = OS_K0_TO_PHYSICAL(roomCtx->activeRoomVram); Scene_ExecuteCommands(play, roomCtx->curRoom.segment); func_80123140(play, GET_PLAYER(play)); @@ -605,7 +605,7 @@ RoomDrawHandler sRoomDrawHandlers[] = { void Room_Draw(PlayState* play, Room* room, u32 flags) { if (room->segment != NULL) { - gSegments[3] = VIRTUAL_TO_PHYSICAL(room->segment); + gSegments[3] = OS_K0_TO_PHYSICAL(room->segment); sRoomDrawHandlers[room->roomShape->base.type](play, room, flags); } return; @@ -620,5 +620,5 @@ void func_8012EBF8(PlayState* play, RoomContext* roomCtx) { Map_InitRoomData(play, roomCtx->curRoom.num); Minimap_SavePlayerRoomInitInfo(play); } - func_801A3CD8(play->roomCtx.curRoom.echo); + Audio_SetEnvReverb(play->roomCtx.curRoom.echo); } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 923ba5a0e..326e010ea 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -65,7 +65,7 @@ void Object_InitContext(GameState* gameState, ObjectContext* objectCtx) { objectCtx->spaceEnd = (void*)((u32)objectCtx->spaceStart + spaceSize); objectCtx->mainKeepSlot = Object_SpawnPersistent(objectCtx, GAMEPLAY_KEEP); - gSegments[4] = VIRTUAL_TO_PHYSICAL(objectCtx->slots[objectCtx->mainKeepSlot].segment); + gSegments[4] = OS_K0_TO_PHYSICAL(objectCtx->slots[objectCtx->mainKeepSlot].segment); } void Object_UpdateEntries(ObjectContext* objectCtx) { @@ -240,7 +240,7 @@ void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) { if (cmd->specialFiles.subKeepId != 0) { play->objectCtx.subKeepSlot = Object_SpawnPersistent(&play->objectCtx, cmd->specialFiles.subKeepId); // TODO: Segment number enum? - gSegments[0x05] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[play->objectCtx.subKeepSlot].segment); + gSegments[0x05] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[play->objectCtx.subKeepSlot].segment); } if (cmd->specialFiles.naviQuestHintFileId != NAVI_QUEST_HINTS_NONE) { diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index 01a493cc0..83e271edc 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -1663,7 +1663,7 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { gSaveContext.options.zTargetSetting = 0; } } - func_801A3D98(gSaveContext.options.audioSetting); + Audio_SetFileSelectSettings(gSaveContext.options.audioSetting); } } @@ -1861,7 +1861,7 @@ void Sram_WriteSaveOptionsToBuffer(SramContext* sramCtx) { void Sram_InitSram(GameState* gameState, SramContext* sramCtx) { if (gSaveContext.save.entrance) {} // Required to match - func_801A3D98(gSaveContext.options.audioSetting); + Audio_SetFileSelectSettings(gSaveContext.options.audioSetting); } void Sram_Alloc(GameState* gameState, SramContext* sramCtx) { diff --git a/src/code/z_visfbuf.c b/src/code/z_visfbuf.c new file mode 100644 index 000000000..62242bcec --- /dev/null +++ b/src/code/z_visfbuf.c @@ -0,0 +1,329 @@ +/** + * @file z_visfbuf.c + * @brief Copies images between color images (generally framebuffers), possibly with filling, scaling, and colour + * interpolation. + * + * Used for several transition effects, and in z_play to shrink the screen at the end of the First and Second Days. + * + * @note to use the functions in this file, with the exception of VisFbuf_Draw(), it is necessary to load the S2DEX2 + * microcode first, and then re-load the 3D microcode afterwards for the rest of the drawing in the frame; see + * VisFbuf_Draw() for how to do this. + */ + +#include "global.h" +#include "z64visfbuf.h" +#include "sys_cfb.h" + +#define SCALE_MIN 0.032f +#define SCALE_MAX 1.0f //!< also unchanged scale + +void VisFbuf_Init(VisFbuf* this) { + bzero(this, sizeof(VisFbuf)); +} + +void VisFbuf_Destroy(VisFbuf* this) { +} + +// internal, only used in VisFbuf_SetBg +/** + * Draw a bg to the specified color image. + * + * @param[in,out] gfxP Pointer to current displaylist + * @param[in] bg BG object to draw + * @param[out] img Pointer to beginning of destination color image + * @param[in] width Output width in pixels + * @param[in] height Output height in pixels + * @param[in] cycleMode Which BG mode to use + */ +void VisFbuf_DrawBgToColorImage(Gfx** gfxP, uObjBg* bg, void* img, s32 width, s32 height, VisFbufBgMode cycleMode) { + Gfx* gfx = *gfxP; + + gDPPipeSync(gfx++); + // Set up color image to draw bg to + gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, img); + gDPSetScissor(gfx++, 0, 0, 0, width, height); + + // Draw bg in appropriate type + gSPObjRenderMode(gfx++, G_OBJRM_ANTIALIAS | G_OBJRM_BILERP); + if (!!(cycleMode & VIS_FBUF_BG_CYC_COPY) != 0) { //! FAKE: may possibly be a better way + gSPBgRectCopy(gfx++, bg); + } else { + gSPBgRect1Cyc(gfx++, bg); + } + + gDPPipeSync(gfx++); + // Reset the color image and scissor to frame's defaults + gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gCfbWidth, D_0F000000); + gSPDisplayList(gfx++, D_0E000000.setScissor); + + *gfxP = gfx; +} + +// internal +/** + * Set up a BG from a specified source image and draw it to the specified color image with + * VisFbuf_DrawBgToColorImage(), using the BG's settings. Use VisFbuf_SetBgSimple() or + * VisFbuf_SetBgGeneral() + * + * @param[out] gfxP Pointer to current displaylist + * @param[in] source Pointer to beginning of source color image + * @param[out] img Pointer to beginning of destination color image + * @param[in] width Output width in pixels + * @param[in] height Output height in pixels + * @param[in] x Left of drawn output + * @param[in] y Top of drawn output + * @param[in] scaleX Amount to rescale the image, (dsdx). No effect if `cycleMode` is `VIS_FBUF_BG_CYC_COPY`. + * @param[in] scaleY Amount to rescale the image, (dtdy). No effect if `cycleMode` is `VIS_FBUF_BG_CYC_COPY`. + * @param[in] cycleMode Which BG mode to use + */ +void VisFbuf_SetBg(Gfx** gfxP, void* source, void* img, s32 width, s32 height, f32 x, f32 y, f32 scaleX, f32 scaleY, + VisFbufBgMode cycleMode) { + Gfx* gfx = *gfxP; + Gfx* gfxTemp; + uObjBg* bg; + + // Allocate for BG + gfxTemp = gfx; + bg = Graph_DlistAlloc(&gfxTemp, sizeof(uObjBg)); + gfx = gfxTemp; + + // Set up BG + bg->b.imageX = 0; + bg->b.imageW = width << 2; + bg->b.frameX = x * 4; + bg->b.frameW = width << 2; + bg->b.imageY = 0; + bg->b.imageH = height << 2; + bg->b.frameY = y * 4; + bg->b.frameH = height << 2; + bg->b.imageLoad = G_BGLT_LOADTILE; + bg->b.imageFmt = G_IM_FMT_RGBA; + bg->b.imageSiz = G_IM_SIZ_16b; + bg->b.imagePal = 0; + bg->b.imageFlip = 0; + bg->b.imagePtr = source; + + if (!!(cycleMode & VIS_FBUF_BG_CYC_COPY) != 0) { //! FAKE: may possibly be a better way + guS2DInitBg(bg); + } else { + bg->s.scaleW = (s32)((1 << 10) / scaleX); + bg->s.scaleH = (s32)((1 << 10) / scaleY); + bg->s.imageYorig = bg->b.imageY; + } + + // draw BG to `img` + VisFbuf_DrawBgToColorImage(&gfx, bg, img, width, height, cycleMode); + + *gfxP = gfx; +} + +// used in FbdemoWipe5 and internally +// "default settings" wrapper for VisFbuf_SetBg +/** + * Set up a BG from a specified source image and draw it to the specified color image with + * VisFbuf_DrawBgToColorImage(), using the BG's settings. Position uses the default (0,0), and no rescaling is done + * even if 1-cycle mode is enabled. + * + * @see VisFbuf_SetBg() for arguments. + */ +void VisFbuf_SetBgSimple(Gfx** gfxP, void* source, void* img, s32 width, s32 height, VisFbufBgMode cycleMode) { + VisFbuf_SetBg(gfxP, source, img, width, height, 0.0f, 0.0f, SCALE_MAX, SCALE_MAX, cycleMode); +} + +// wrapper for VisFbuf_SetBg with general arguments, used in VisFbuf_ApplyEffects +/** + * Set up a BG from a specified source image and draw it to the specified color image with + * VisFbuf_DrawBgToColorImage(). Fully general settings are available. + * + * @see VisFbuf_SetBg() for arguments. + */ +void VisFbuf_SetBgGeneral(Gfx** gfxP, void* source, void* img, s32 width, s32 height, f32 x, f32 y, f32 scaleX, + f32 scaleY, VisFbufBgMode cycleMode) { + VisFbuf_SetBg(gfxP, source, img, width, height, x, y, scaleX, scaleY, cycleMode); +} + +// internal, used in VisFbuf_DrawGeneral +/** + * Most general redrawing function. + * + * - Copies `source` to `img`, + * - fills the current framebuffer with `this->primColor`, + * - applies colour interpolation to `img`, + * - copies `img` back to `source`, with rescaling. + * + * @param[in] this + * @param[in,out] gfxP Pointer to current displaylist + * @param[in,out] source Pointer to beginning of in/out color image + * @param[out] img Pointer to beginning of destination color image + * @param[in] width Output width in pixels + * @param[in] height Output height in pixels + */ +void VisFbuf_ApplyEffects(VisFbuf* this, Gfx** gfxP, void* source, void* img, s32 width, s32 height) { + Gfx* gfx = *gfxP; + s32 pad[3]; + + gDPPipeSync(gfx++); + // copy source to img + gDPSetOtherMode(gfx++, + G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_COPY | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); + VisFbuf_SetBgSimple(&gfx, source, img, width, height, VIS_FBUF_BG_CYC_COPY); + + gDPPipeSync(gfx++); + // fill framebuffer with primColor + gDPSetOtherMode(gfx++, + G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_FILL | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); + { + s32 color = GPACK_RGBA5551(this->primColor.r, this->primColor.g, (u32)this->primColor.b, 1); + + gDPSetFillColor(gfx++, (color << 0x10) | color); + } + //! @bug VisFbuf_SetBgSimple() sets the current color image back to the frame's default framebuffer at the end, + //! so this will always fill in the default framebuffer, whatever are used as `source` and `img`. This does not + //! arise in-game since this function is always used with `source = D_0F000000`. + gDPFillRectangle(gfx++, 0, 0, width - 1, height - 1); + + gDPPipeSync(gfx++); + // Set lod and primColor from struct, perform interpolation, draw image with scaling (this is the most general + // alteration this system can carry out). + { + s32 lodFrac = this->lodProportion * 255; + + gDPSetLODColor(gfx++, G_SETPRIMCOLOR, 0, lodFrac, this->primColor.rgba); + } + if (this->envColor.a == 0) { + // Interpolate between primColor and texel color using lod (but with max alpha) + gDPSetOtherMode(gfx++, + G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_THRESHOLD | G_ZS_PIXEL | AA_EN | CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | ALPHA_CVG_SEL | + GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_BL, G_BL_1MA) | + GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_BL, G_BL_1MA)); + gDPSetCombineLERP(gfx++, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, TEXEL0, 0, 0, 0, 1, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, + TEXEL0, 0, 0, 0, 1); + } else { + // Interpolate between envColor (the new black) and primColor (the new white) + gDPSetOtherMode(gfx++, + G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PIXEL | G_RM_CLD_SURF | G_RM_NOOP2); + gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba); + gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, + ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, + ENVIRONMENT); + } + + // Draw scaled image in centre of `width * height` rectangle in `source` + { + f32 scale = CLAMP_ALT(this->scale, SCALE_MIN, SCALE_MAX); + + VisFbuf_SetBgGeneral(&gfx, img, source, width, height, width * 0.5f * (1.0f - scale), + height * 0.5f * (1.0f - scale), scale, scale, VIS_FBUF_BG_CYC_1CYC); + } + + gDPPipeSync(gfx++); + + *gfxP = gfx; +} + +// internal, used in VisFbuf_Draw, VIS_FBUF_MODE_GENERAL +/** + * If scale is within `(SCALE_MIN, SCALE_MAX)`, apply VisFbuf_ApplyEffects(). + * If it is smaller than `SCALE_MIN`, fill the framebuffer with `this->primColor` + * + * @param[in] this + * @param[in,out] gfxP Pointer to current displaylist + * @param[in,out] source Pointer to beginning of source color image + * @param[in,out] img Pointer to beginning of destination color image + * @param[in] width Output width in pixels + * @param[in] height Output height in pixels + */ +void VisFbuf_DrawGeneral(VisFbuf* this, Gfx** gfxP, void* source, void* img, s32 width, s32 height) { + if (this->scale < SCALE_MAX) { + Gfx* gfx = *gfxP; + u32 color; + + if (this->scale > SCALE_MIN) { + VisFbuf_ApplyEffects(this, &gfx, source, img, width, height); + } else { + gDPPipeSync(gfx++); + // fill the framebuffer with this->primColor + gDPSetOtherMode(gfx++, + G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_FILL | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); + color = GPACK_RGBA5551(this->primColor.r, this->primColor.g, (u32)this->primColor.b, 1); + gDPSetFillColor(gfx++, (color << 0x10) | color); + //! @bug See corresponding note in VisFbuf_ApplyEffects() + gDPFillRectangle(gfx++, 0, 0, width - 1, height - 1); + + gDPPipeSync(gfx++); + } + + *gfxP = gfx; + } +} + +/** + * Redraw `img` in-place, using texel color to interpolate between envColor (the new black) and primColor (the new + * white) + * + * @param[in] this + * @param[in,out] gfxP Pointer to current displaylist + * @param[in,out] img Pointer to beginning of color image to modify in-place + * @param[in] width width of img + * @param[in] height height of img + */ +void VisFbuf_DrawInterpolate(VisFbuf* this, Gfx** gfxP, void* img, s32 width, s32 height) { + Gfx* gfx = *gfxP; + + gDPPipeSync(gfx++); + + gDPSetOtherMode(gfx++, + G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PIXEL | G_RM_CLD_SURF | G_RM_NOOP2); + gDPSetColor(gfx++, G_SETPRIMCOLOR, this->primColor.rgba); + gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba); + gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT); + VisFbuf_SetBgSimple(&gfx, img, img, width, height, VIS_FBUF_BG_CYC_1CYC); + + gDPPipeSync(gfx++); + + *gfxP = gfx; +} + +// used in Play and FbdemoWipe4 +/** + * main drawing function in this file, draws depending on settings specified in `this`. + * + * @param[in] this + * @param[in,out] gfxP Pointer to current displaylist + * @param[in,out] img Pointer to beginning of destination color image + */ +void VisFbuf_Draw(VisFbuf* this, Gfx** gfxP, void* img) { + Gfx* gfx = *gfxP; + + gSPLoadUcodeL(gfx++, gspS2DEX2_fifo); + + switch (this->mode) { + case VIS_FBUF_MODE_GENERAL: + VisFbuf_DrawGeneral(this, &gfx, D_0F000000, img, gScreenWidth, gScreenHeight); + break; + + case VIS_FBUF_MODE_INTERPOLATE: + VisFbuf_DrawInterpolate(this, &gfx, D_0F000000, gScreenWidth, gScreenHeight); + break; + + default: + break; + } + + gSPLoadUcode(gfx++, SysUcode_GetUCode(), SysUcode_GetUCodeData()); + + *gfxP = gfx; +} diff --git a/src/libultra/flash/osFlash.c b/src/libultra/flash/osFlash.c index 6a744a95e..17162c53c 100644 --- a/src/libultra/flash/osFlash.c +++ b/src/libultra/flash/osFlash.c @@ -1,19 +1,25 @@ -#include "prevent_bss_reordering.h" #include "ultra64.h" -#include "global.h" #include "PR/os_internal_flash.h" +#include "alignment.h" +#include "macros.h" -u32 __osFlashID[4]; -OSIoMesg __osFlashMsg; -OSMesgQueue __osFlashMessageQ; -OSPiHandle __osFlashHandler; +u32 __osFlashID[4] ALIGNED(8); +OSIoMesg __osFlashMsg ALIGNED(8); +OSMesgQueue __osFlashMessageQ ALIGNED(8); +OSPiHandle __osFlashHandler ALIGNED(8); OSMesg __osFlashMsgBuf[1]; s32 __osFlashVersion; static s32 sBssPad[5]; uintptr_t osFlashGetAddr(u32 pageNum) { - // Account for hadware bug in old flash where the address bits are shifted 1-off where they should be - uintptr_t addr = (__osFlashVersion == OLD_FLASH) ? pageNum * (FLASH_BLOCK_SIZE >> 1) : pageNum * FLASH_BLOCK_SIZE; + uintptr_t addr; + + if (__osFlashVersion == OLD_FLASH) { + // Account for hardware bug in old flash where the address bits are shifted 1-off where they should be + addr = pageNum * (FLASH_BLOCK_SIZE >> 1); + } else { + addr = pageNum * FLASH_BLOCK_SIZE; + } return addr; } diff --git a/src/libultra/gu/coss.c b/src/libultra/gu/coss.c index ebed28405..cd134d07b 100644 --- a/src/libultra/gu/coss.c +++ b/src/libultra/gu/coss.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" /** * Compute the sine of a hex angle and return a short, using the formula cos(x) = sin(x+pi). diff --git a/src/libultra/gu/lookat.c b/src/libultra/gu/lookat.c index e1c7500cf..692bb089a 100644 --- a/src/libultra/gu/lookat.c +++ b/src/libultra/gu/lookat.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "ultra64.h" +#include "macros.h" void guLookAtF(f32 mf[4][4], f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp) { f32 length; diff --git a/src/libultra/gu/lookathil.c b/src/libultra/gu/lookathil.c index 22540337c..ef8b443db 100644 --- a/src/libultra/gu/lookathil.c +++ b/src/libultra/gu/lookathil.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "ultra64.h" +#include "macros.h" void guLookAtHiliteF(f32 mf[4][4], LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp, f32 xl1, f32 yl1, f32 zl1, /* light 1 direction */ diff --git a/src/libultra/gu/ortho.c b/src/libultra/gu/ortho.c index 592f2995d..2a1d78518 100644 --- a/src/libultra/gu/ortho.c +++ b/src/libultra/gu/ortho.c @@ -1,8 +1,9 @@ -#include "global.h" +#include "ultra64.h" void guOrthoF(float m[4][4], float l, float r, float b, float t, float n, float f, float scale) { int i; int j; + guMtxIdentF(m); m[0][0] = 2 / (r - l); m[1][1] = 2 / (t - b); @@ -20,6 +21,7 @@ void guOrthoF(float m[4][4], float l, float r, float b, float t, float n, float void guOrtho(Mtx* m, float l, float r, float b, float t, float n, float f, float scale) { float mf[4][4]; + guOrthoF(mf, l, r, b, t, n, f, scale); guMtxF2L(mf, m); } diff --git a/src/libultra/gu/perspective.c b/src/libultra/gu/perspective.c index d3dab2ef4..a869e7723 100644 --- a/src/libultra/gu/perspective.c +++ b/src/libultra/gu/perspective.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void guPerspectiveF(float mf[4][4], u16* perspNorm, float fovy, float aspect, float near, float far, float scale) { float cot; @@ -36,6 +36,7 @@ void guPerspectiveF(float mf[4][4], u16* perspNorm, float fovy, float aspect, fl void guPerspective(Mtx* m, u16* perspNorm, float fovy, float aspect, float near, float far, float scale) { float mf[4][4]; + guPerspectiveF(mf, perspNorm, fovy, aspect, near, far, scale); guMtxF2L(mf, m); } diff --git a/src/libultra/gu/position.c b/src/libultra/gu/position.c index 9ba9d3570..17852abc0 100644 --- a/src/libultra/gu/position.c +++ b/src/libultra/gu/position.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "ultra64.h" +#include "libc/math.h" /** * guPositionF diff --git a/src/libultra/gu/rotate.c b/src/libultra/gu/rotate.c index 46dd605d4..b51c35fef 100644 --- a/src/libultra/gu/rotate.c +++ b/src/libultra/gu/rotate.c @@ -1,7 +1,8 @@ -#include "global.h" +#include "ultra64.h" +#include "libc/math.h" void guRotateF(float m[4][4], float a, float x, float y, float z) { - static float D_80097F90 = M_PI / 180.0f; + static float dtor = M_PI / 180.0f; float sine; float cosine; float ab; @@ -14,7 +15,7 @@ void guRotateF(float m[4][4], float a, float x, float y, float z) { guNormalize(&x, &y, &z); - a = a * D_80097F90; + a *= dtor; sine = sinf(a); cosine = cosf(a); diff --git a/src/libultra/gu/sqrtf.c b/src/libultra/gu/sqrtf.c index 5e5fa233c..70e59989e 100644 --- a/src/libultra/gu/sqrtf.c +++ b/src/libultra/gu/sqrtf.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #ifndef __GNUC__ #define __builtin_sqrtf sqrtf diff --git a/src/libultra/gu/guS2DInitBg.c b/src/libultra/gu/us2dex.c similarity index 97% rename from src/libultra/gu/guS2DInitBg.c rename to src/libultra/gu/us2dex.c index c87176f49..810a7d3d1 100644 --- a/src/libultra/gu/guS2DInitBg.c +++ b/src/libultra/gu/us2dex.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "PR/gs2dex.h" void guS2DInitBg(uObjBg* bg) { diff --git a/src/libultra/io/aigetlen.c b/src/libultra/io/aigetlen.c index 58d8db487..0e7171928 100644 --- a/src/libultra/io/aigetlen.c +++ b/src/libultra/io/aigetlen.c @@ -1,5 +1,5 @@ -#include "global.h" +#include "ultra64.h" u32 osAiGetLength(void) { - return HW_REG(AI_LEN_REG, u32); + return IO_READ(AI_LEN_REG); } diff --git a/src/libultra/io/aisetfreq.c b/src/libultra/io/aisetfreq.c index 8702941b9..8771b4c95 100644 --- a/src/libultra/io/aisetfreq.c +++ b/src/libultra/io/aisetfreq.c @@ -1,20 +1,20 @@ -#include "global.h" +#include "ultra64.h" s32 osAiSetFrequency(u32 frequency) { u8 bitrate; f32 dacRateF = ((f32)osViClock / frequency) + 0.5f; u32 dacRate = dacRateF; - if (dacRate < 132) { + if (dacRate < AI_MIN_DAC_RATE) { return -1; } bitrate = (dacRate / 66); - if (bitrate > 16) { - bitrate = 16; + if (bitrate > AI_MAX_BIT_RATE) { + bitrate = AI_MAX_BIT_RATE; } - HW_REG(AI_DACRATE_REG, u32) = dacRate - 1; - HW_REG(AI_BITRATE_REG, u32) = bitrate - 1; + IO_WRITE(AI_DACRATE_REG, dacRate - 1); + IO_WRITE(AI_BITRATE_REG, bitrate - 1); return osViClock / (s32)dacRate; } diff --git a/src/libultra/io/cartrominit.c b/src/libultra/io/cartrominit.c index 39de77260..eeca4b339 100644 --- a/src/libultra/io/cartrominit.c +++ b/src/libultra/io/cartrominit.c @@ -1,6 +1,8 @@ -#include "global.h" +#include "ultra64.h" +#include "libc/stdbool.h" +#include "alignment.h" -OSPiHandle __CartRomHandle; +OSPiHandle __CartRomHandle ALIGNED(8); OSPiHandle* osCartRomInit(void) { register u32 initialConfig; @@ -22,36 +24,36 @@ OSPiHandle* osCartRomInit(void) { sCartRomNeedsInit = false; __CartRomHandle.type = DEVICE_TYPE_CART; - __CartRomHandle.baseAddress = 0xB0000000; - __CartRomHandle.domain = 0; + __CartRomHandle.baseAddress = PHYS_TO_K1(PI_DOM1_ADDR2); + __CartRomHandle.domain = PI_DOMAIN1; __CartRomHandle.speed = 0; bzero(&__CartRomHandle.transferInfo, sizeof(__OSTranxInfo)); /* Uses `status & PI_STATUS_ERROR` in OoT */ - while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) { + while (status = IO_READ(PI_STATUS_REG), status & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) { ; } - lastLatency = HW_REG(PI_BSD_DOM1_LAT_REG, u32); - lastPageSize = HW_REG(PI_BSD_DOM1_PGS_REG, u32); - lastRelDuration = HW_REG(PI_BSD_DOM1_RLS_REG, u32); - lastPulse = HW_REG(PI_BSD_DOM1_PWD_REG, u32); + lastLatency = IO_READ(PI_BSD_DOM1_LAT_REG); + lastPageSize = IO_READ(PI_BSD_DOM1_PGS_REG); + lastRelDuration = IO_READ(PI_BSD_DOM1_RLS_REG); + lastPulse = IO_READ(PI_BSD_DOM1_PWD_REG); - HW_REG(PI_BSD_DOM1_LAT_REG, u32) = 0xFF; - HW_REG(PI_BSD_DOM1_PGS_REG, u32) = 0; - HW_REG(PI_BSD_DOM1_RLS_REG, u32) = 3; - HW_REG(PI_BSD_DOM1_PWD_REG, u32) = 0xFF; + IO_WRITE(PI_BSD_DOM1_LAT_REG, 0xFF); + IO_WRITE(PI_BSD_DOM1_PGS_REG, 0); + IO_WRITE(PI_BSD_DOM1_RLS_REG, 3); + IO_WRITE(PI_BSD_DOM1_PWD_REG, 0xFF); - initialConfig = HW_REG(__CartRomHandle.baseAddress, u32); + initialConfig = IO_READ(__CartRomHandle.baseAddress); __CartRomHandle.latency = initialConfig & 0xFF; __CartRomHandle.pageSize = (initialConfig >> 0x10) & 0xF; __CartRomHandle.relDuration = (initialConfig >> 0x14) & 0xF; __CartRomHandle.pulse = (initialConfig >> 8) & 0xFF; - HW_REG(PI_BSD_DOM1_LAT_REG, u32) = lastLatency; - HW_REG(PI_BSD_DOM1_PGS_REG, u32) = lastPageSize; - HW_REG(PI_BSD_DOM1_RLS_REG, u32) = lastRelDuration; - HW_REG(PI_BSD_DOM1_PWD_REG, u32) = lastPulse; + IO_WRITE(PI_BSD_DOM1_LAT_REG, lastLatency); + IO_WRITE(PI_BSD_DOM1_PGS_REG, lastPageSize); + IO_WRITE(PI_BSD_DOM1_RLS_REG, lastRelDuration); + IO_WRITE(PI_BSD_DOM1_PWD_REG, lastPulse); prevInt = __osDisableInt(); __CartRomHandle.next = __osPiTable; diff --git a/src/libultra/io/contchannelreset.c b/src/libultra/io/contchannelreset.c index d0f1fbd9b..d0dc33eef 100644 --- a/src/libultra/io/contchannelreset.c +++ b/src/libultra/io/contchannelreset.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "ultra64.h" +#include "PR/controller.h" s32 __osContChannelReset(OSMesgQueue* mq, s32 channel) { s32 i; @@ -7,13 +8,13 @@ s32 __osContChannelReset(OSMesgQueue* mq, s32 channel) { __osSiGetAccess(); - __osPfsPifRam.status = 1; + __osPfsPifRam.status = CONT_CMD_EXE; for (i = 0; i < channel; i++) { - *bufptr++ = 0; + *bufptr++ = CONT_CMD_REQUEST_STATUS; } - *bufptr++ = 0xFD; + *bufptr++ = CONT_CMD_CHANNEL_RESET; *bufptr = CONT_CMD_END; __osSiRawStartDma(OS_WRITE, &__osPfsPifRam); diff --git a/src/libultra/io/contpfs.c b/src/libultra/io/contpfs.c index e6817c3d0..b86f35c0d 100644 --- a/src/libultra/io/contpfs.c +++ b/src/libultra/io/contpfs.c @@ -1,39 +1,9 @@ #include "ultra64.h" -#include "global.h" +#include "PR/controller.h" +#include "alignment.h" + +__OSInode __osPfsInodeCache ALIGNED(8); -__OSInode __osPfsInodeCache; -OSViMode osViModeNtscHpn1 = { - 8, // type - { - // comRegs - 0x324E, // ctrl - 0x500, // width - 0x3E52239, // burst - 0x20C, // vSync - 0xC15, // hSync - 0xC150C15, // leap - 0x6C02EC, // hStart - 0x400, // xScale - 0, // vCurrent - }, - { // fldRegs - { - // [0] - 0x500, // origin - 0x400, // yScale - 0x2301FD, // vStart - 0xE0204, // vBurst - 2, // vIntr - }, - { - // [1] - 0xA00, // origin - 0x400, // yScale - 0x2501FF, // vStart - 0xE0204, // vBurst - 2, // vIntr - } }, -}; s32 __osPfsInodeCacheChannel = -1; u8 __osPfsInodeCacheBank = 250; diff --git a/src/libultra/io/contquery.c b/src/libultra/io/contquery.c index a9a944f54..cacf95616 100644 --- a/src/libultra/io/contquery.c +++ b/src/libultra/io/contquery.c @@ -1,19 +1,20 @@ -#include "global.h" +#include "ultra64.h" +#include "PR/controller.h" s32 osContStartQuery(OSMesgQueue* mq) { s32 ret; __osSiGetAccess(); - if (__osContLastPoll != 0) { - __osPackRequestData(0); + if (__osContLastPoll != CONT_CMD_REQUEST_STATUS) { + __osPackRequestData(CONT_CMD_REQUEST_STATUS); __osSiRawStartDma(OS_WRITE, &__osContPifRam); osRecvMesg(mq, NULL, OS_MESG_BLOCK); } ret = __osSiRawStartDma(OS_READ, &__osContPifRam); - __osContLastPoll = 0; + __osContLastPoll = CONT_CMD_REQUEST_STATUS; __osSiRelAccess(); diff --git a/src/libultra/io/contramread.c b/src/libultra/io/contramread.c index 06def61ba..56b928d37 100644 --- a/src/libultra/io/contramread.c +++ b/src/libultra/io/contramread.c @@ -1,5 +1,6 @@ -#include "global.h" -#include "PR/voice_internal.h" +#include "ultra64.h" +#include "PR/controller.h" +#include "PR/voiceinternal.h" #define BLOCKSIZE 32 diff --git a/src/libultra/io/contramwrite.c b/src/libultra/io/contramwrite.c index 507fbb1e8..0c8443409 100644 --- a/src/libultra/io/contramwrite.c +++ b/src/libultra/io/contramwrite.c @@ -1,6 +1,6 @@ #include "ultra64.h" -#include "PR/voice_internal.h" -#include "global.h" +#include "PR/controller.h" +#include "PR/voiceinternal.h" s32 __osContRamWrite(OSMesgQueue* mq, s32 channel, u16 address, u8* buffer, s32 force) { s32 ret = 0; diff --git a/src/libultra/io/contreaddata.c b/src/libultra/io/contreaddata.c index 21a8b90ce..eded3a338 100644 --- a/src/libultra/io/contreaddata.c +++ b/src/libultra/io/contreaddata.c @@ -1,4 +1,6 @@ -#include "global.h" +#include "ultra64.h" +#include "PR/controller.h" +#include "macros.h" void __osPackReadData(void); diff --git a/src/libultra/io/controller.c b/src/libultra/io/controller.c index 30cb4c1d9..762dcbb09 100644 --- a/src/libultra/io/controller.c +++ b/src/libultra/io/controller.c @@ -1,13 +1,16 @@ -#include "global.h" +#include "ultra64.h" +#include "PR/controller.h" +#include "alignment.h" +#include "macros.h" s32 __osContinitialized = false; -OSPifRam __osContPifRam; +OSPifRam __osContPifRam ALIGNED(16); u8 __osContLastPoll; u8 __osMaxControllers; OSTimer __osEepromTimer; -OSMesgQueue __osEepromTimerQ; +OSMesgQueue __osEepromTimerQ ALIGNED(8); OSMesg __osEepromTimerMsg[1]; s32 osContInit(OSMesgQueue* mq, u8* bitpattern, OSContStatus* data) { @@ -24,15 +27,15 @@ s32 osContInit(OSMesgQueue* mq, u8* bitpattern, OSContStatus* data) { __osContinitialized = true; t = osGetTime(); - if (t < 0x165A0BC) { + if (t < OS_USEC_TO_CYCLES(500000)) { osCreateMesgQueue(&timerMesgQueue, &dummy, 1); - osSetTimer(&mytimer, 0x165A0BC - t, 0, &timerMesgQueue, &dummy); + osSetTimer(&mytimer, OS_USEC_TO_CYCLES(500000) - t, 0, &timerMesgQueue, &dummy); osRecvMesg(&timerMesgQueue, &dummy, OS_MESG_BLOCK); } __osMaxControllers = 4; - __osPackRequestData(0); + __osPackRequestData(CONT_CMD_REQUEST_STATUS); ret = __osSiRawStartDma(OS_WRITE, &__osContPifRam); osRecvMesg(mq, &dummy, OS_MESG_BLOCK); @@ -50,15 +53,16 @@ s32 osContInit(OSMesgQueue* mq, u8* bitpattern, OSContStatus* data) { void __osContGetInitData(u8* pattern, OSContStatus* data) { u8* ptr; - __OSContRequestHeader requestHeader; + __OSContRequesFormat requestHeader; s32 i; u8 bits; bits = 0; ptr = (u8*)__osContPifRam.ramarray; for (i = 0; i < __osMaxControllers; i++, ptr += sizeof(requestHeader), data++) { - requestHeader = *(__OSContRequestHeader*)ptr; - data->errno = (requestHeader.rxsize & 0xC0) >> 4; + requestHeader = *(__OSContRequesFormat*)ptr; + data->errno = CHNL_ERR(requestHeader); + if (data->errno == 0) { data->type = requestHeader.typel << 8 | requestHeader.typeh; data->status = requestHeader.status; @@ -71,7 +75,7 @@ void __osContGetInitData(u8* pattern, OSContStatus* data) { void __osPackRequestData(u8 poll) { u8* ptr; - __OSContRequestHeader requestHeader; + __OSContRequesFormat requestHeader; s32 i; for (i = 0; i < ARRAY_COUNT(__osContPifRam.ramarray); i++) { @@ -80,18 +84,18 @@ void __osPackRequestData(u8 poll) { __osContPifRam.status = CONT_CMD_READ_BUTTON; ptr = (u8*)__osContPifRam.ramarray; - requestHeader.align = 255; - requestHeader.txsize = 1; - requestHeader.rxsize = 3; + requestHeader.align = CONT_CMD_NOP; + requestHeader.txsize = CONT_CMD_RESET_TX; + requestHeader.rxsize = CONT_CMD_RESET_RX; requestHeader.poll = poll; - requestHeader.typeh = 255; - requestHeader.typel = 255; - requestHeader.status = 255; - requestHeader.align1 = 255; + requestHeader.typeh = CONT_CMD_NOP; + requestHeader.typel = CONT_CMD_NOP; + requestHeader.status = CONT_CMD_NOP; + requestHeader.align1 = CONT_CMD_NOP; for (i = 0; i < __osMaxControllers; i++) { - *(__OSContRequestHeader*)ptr = requestHeader; + *(__OSContRequesFormat*)ptr = requestHeader; ptr += sizeof(requestHeader); } - *ptr = 254; + *ptr = CONT_CMD_END; } diff --git a/src/libultra/io/contsetch.c b/src/libultra/io/contsetch.c index e2740489c..8868d762b 100644 --- a/src/libultra/io/contsetch.c +++ b/src/libultra/io/contsetch.c @@ -1,14 +1,15 @@ -#include "global.h" +#include "ultra64.h" +#include "PR/controller.h" s32 osContSetCh(u8 ch) { __osSiGetAccess(); - if (4 < ch) { - __osMaxControllers = 4; + if (ch > MAXCONTROLLERS) { + __osMaxControllers = MAXCONTROLLERS; } else { __osMaxControllers = ch; } - __osContLastPoll = -2; + __osContLastPoll = CONT_CMD_END; __osSiRelAccess(); return 0; diff --git a/src/libultra/io/crc.c b/src/libultra/io/crc.c index acae7b408..235b1c077 100644 --- a/src/libultra/io/crc.c +++ b/src/libultra/io/crc.c @@ -69,7 +69,7 @@ * implementing CRC (Cyclic Redundancy Check) calculation * ](http://www.sunshine2k.de/articles/coding/crc/understanding_crc.html) */ -#include "global.h" +#include "ultra64.h" #define ADDRESS_CRC_MESSAGE_LENGTH 10 #define ADDRESS_CRC_LENGTH 5 diff --git a/src/libultra/io/devmgr.c b/src/libultra/io/devmgr.c index b27822afa..168ca9b8d 100644 --- a/src/libultra/io/devmgr.c +++ b/src/libultra/io/devmgr.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "ultra64.h" +#include "libc/stdbool.h" void __osDevMgrMain(void* arg) { OSIoMesg* ioMesg; @@ -34,31 +35,32 @@ void __osDevMgrMain(void* arg) { } osRecvMesg(devMgr->acsQueue, &sp6C, OS_MESG_BLOCK); - __osResetGlobalIntMask(0x00100401); - __osEPiRawWriteIo(ioMesg->piHandle, 0x05000510, transfer->bmCtlShadow | 0x80000000); + __osResetGlobalIntMask(OS_IM_PI); + __osEPiRawWriteIo(ioMesg->piHandle, LEO_BM_CTL, transfer->bmCtlShadow | LEO_BM_CTL_START); - label: + readblock1: osRecvMesg(devMgr->evtQueue, &sp70, OS_MESG_BLOCK); transfer = &ioMesg->piHandle->transferInfo; block = &transfer->block[transfer->blockNum]; if (block->errStatus == 0x1D) { u32 status; - __osEPiRawWriteIo(ioMesg->piHandle, 0x05000510, transfer->bmCtlShadow | 0x10000000); - __osEPiRawWriteIo(ioMesg->piHandle, 0x05000510, transfer->bmCtlShadow); - __osEPiRawReadIo(ioMesg->piHandle, 0x05000508, &status); - if (status & 0x02000000) { - __osEPiRawWriteIo(ioMesg->piHandle, 0x05000510, transfer->bmCtlShadow | 0x1000000); + __osEPiRawWriteIo(ioMesg->piHandle, LEO_BM_CTL, transfer->bmCtlShadow | LEO_BM_CTL_RESET); + __osEPiRawWriteIo(ioMesg->piHandle, LEO_BM_CTL, transfer->bmCtlShadow); + __osEPiRawReadIo(ioMesg->piHandle, LEO_STATUS, &status); + if (status & LEO_STATUS_MECHANIC_INTERRUPT) { + __osEPiRawWriteIo(ioMesg->piHandle, LEO_BM_CTL, + transfer->bmCtlShadow | LEO_BM_CTL_CLR_MECHANIC_INTR); } block->errStatus = 4; - HW_REG(PI_STATUS_REG, u32) = PI_CLR_INTR; - __osSetGlobalIntMask(0x00100C01); + IO_WRITE(PI_STATUS_REG, PI_CLR_INTR); + __osSetGlobalIntMask(OS_IM_PI | SR_IBIT4); } osSendMesg(ioMesg->hdr.retQueue, (OSMesg)ioMesg, OS_MESG_NOBLOCK); if ((msgVar == 1) && (ioMesg->piHandle->transferInfo.block[0].errStatus == 0)) { msgVar = 0; - goto label; + goto readblock1; } osSendMesg(devMgr->acsQueue, NULL, OS_MESG_NOBLOCK); diff --git a/src/libultra/io/dpgetstat.c b/src/libultra/io/dpgetstat.c index 0c4b3073b..1dbf5e09b 100644 --- a/src/libultra/io/dpgetstat.c +++ b/src/libultra/io/dpgetstat.c @@ -1,5 +1,5 @@ -#include "global.h" +#include "ultra64.h" u32 osDpGetStatus(void) { - return HW_REG(DPC_STATUS_REG, u32); + return IO_READ(DPC_STATUS_REG); } diff --git a/src/libultra/io/dpsetstat.c b/src/libultra/io/dpsetstat.c index d2655626c..5eaa88534 100644 --- a/src/libultra/io/dpsetstat.c +++ b/src/libultra/io/dpsetstat.c @@ -1,5 +1,5 @@ -#include "global.h" +#include "ultra64.h" void osDpSetStatus(u32 data) { - HW_REG(DPC_STATUS_REG, u32) = data; + IO_WRITE(DPC_STATUS_REG, data); } diff --git a/src/libultra/io/epidma.c b/src/libultra/io/epidma.c index 0b8c847d6..ba2e55bce 100644 --- a/src/libultra/io/epidma.c +++ b/src/libultra/io/epidma.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 osEPiStartDma(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) { register s32 result; @@ -9,13 +9,13 @@ s32 osEPiStartDma(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) { mb->piHandle = pihandle; - if (direction == 0) { - mb->hdr.type = 15; + if (direction == OS_READ) { + mb->hdr.type = OS_MESG_TYPE_EDMAREAD; } else { - mb->hdr.type = 16; + mb->hdr.type = OS_MESG_TYPE_EDMAWRITE; } - if (mb->hdr.pri == 1) { + if (mb->hdr.pri == OS_MESG_PRI_HIGH) { result = osJamMesg(osPiGetCmdQueue(), mb, OS_MESG_NOBLOCK); } else { result = osSendMesg(osPiGetCmdQueue(), mb, OS_MESG_NOBLOCK); diff --git a/src/libultra/io/epilinkhandle.c b/src/libultra/io/epilinkhandle.c index bedd6d71c..76832e9e3 100644 --- a/src/libultra/io/epilinkhandle.c +++ b/src/libultra/io/epilinkhandle.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 osEPiLinkHandle(OSPiHandle* handle) { u32 saveMask = __osDisableInt(); diff --git a/src/libultra/io/epirawdma.c b/src/libultra/io/epirawdma.c index d0707dce9..737bdce6e 100644 --- a/src/libultra/io/epirawdma.c +++ b/src/libultra/io/epirawdma.c @@ -1,10 +1,10 @@ -#include "global.h" +#include "ultra64.h" s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, uintptr_t cartAddr, void* dramAddr, size_t size) { s32 status; OSPiHandle* curHandle; - while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) { + while (status = IO_READ(PI_STATUS_REG), status & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) { ; } @@ -13,35 +13,35 @@ s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, uintptr_t cartAddr, vo if (handle->domain == 0) { if (curHandle->latency != handle->latency) { - HW_REG(PI_BSD_DOM1_LAT_REG, u32) = handle->latency; + IO_WRITE(PI_BSD_DOM1_LAT_REG, handle->latency); } if (curHandle->pageSize != handle->pageSize) { - HW_REG(PI_BSD_DOM1_PGS_REG, u32) = handle->pageSize; + IO_WRITE(PI_BSD_DOM1_PGS_REG, handle->pageSize); } if (curHandle->relDuration != handle->relDuration) { - HW_REG(PI_BSD_DOM1_RLS_REG, u32) = handle->relDuration; + IO_WRITE(PI_BSD_DOM1_RLS_REG, handle->relDuration); } if (curHandle->pulse != handle->pulse) { - HW_REG(PI_BSD_DOM1_PWD_REG, u32) = handle->pulse; + IO_WRITE(PI_BSD_DOM1_PWD_REG, handle->pulse); } } else { if (curHandle->latency != handle->latency) { - HW_REG(PI_BSD_DOM2_LAT_REG, u32) = handle->latency; + IO_WRITE(PI_BSD_DOM2_LAT_REG, handle->latency); } if (curHandle->pageSize != handle->pageSize) { - HW_REG(PI_BSD_DOM2_PGS_REG, u32) = handle->pageSize; + IO_WRITE(PI_BSD_DOM2_PGS_REG, handle->pageSize); } if (curHandle->relDuration != handle->relDuration) { - HW_REG(PI_BSD_DOM2_RLS_REG, u32) = handle->relDuration; + IO_WRITE(PI_BSD_DOM2_RLS_REG, handle->relDuration); } if (curHandle->pulse != handle->pulse) { - HW_REG(PI_BSD_DOM2_PWD_REG, u32) = handle->pulse; + IO_WRITE(PI_BSD_DOM2_PWD_REG, handle->pulse); } } @@ -52,15 +52,15 @@ s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, uintptr_t cartAddr, vo curHandle->pulse = handle->pulse; } - HW_REG(PI_DRAM_ADDR_REG, void*) = (void*)osVirtualToPhysical(dramAddr); - HW_REG(PI_CART_ADDR_REG, void*) = (void*)((handle->baseAddress | cartAddr) & 0x1FFFFFFF); + IO_WRITE(PI_DRAM_ADDR_REG, osVirtualToPhysical(dramAddr)); + IO_WRITE(PI_CART_ADDR_REG, K1_TO_PHYS(handle->baseAddress | cartAddr)); switch (direction) { case OS_READ: - HW_REG(PI_WR_LEN_REG, u32) = size - 1; + IO_WRITE(PI_WR_LEN_REG, size - 1); break; case OS_WRITE: - HW_REG(PI_RD_LEN_REG, u32) = size - 1; + IO_WRITE(PI_RD_LEN_REG, size - 1); break; default: return -1; diff --git a/src/libultra/io/epirawread.c b/src/libultra/io/epirawread.c index 1dd2d1381..a9379c492 100644 --- a/src/libultra/io/epirawread.c +++ b/src/libultra/io/epirawread.c @@ -1,10 +1,10 @@ -#include "global.h" +#include "ultra64.h" s32 __osEPiRawReadIo(OSPiHandle* handle, uintptr_t devAddr, u32* data) { s32 status; OSPiHandle* curHandle; - while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) { + while (status = IO_READ(PI_STATUS_REG), status & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) { ; } @@ -13,35 +13,35 @@ s32 __osEPiRawReadIo(OSPiHandle* handle, uintptr_t devAddr, u32* data) { if (handle->domain == 0) { if (curHandle->latency != handle->latency) { - HW_REG(PI_BSD_DOM1_LAT_REG, u32) = handle->latency; + IO_WRITE(PI_BSD_DOM1_LAT_REG, handle->latency); } if (curHandle->pageSize != handle->pageSize) { - HW_REG(PI_BSD_DOM1_PGS_REG, u32) = handle->pageSize; + IO_WRITE(PI_BSD_DOM1_PGS_REG, handle->pageSize); } if (curHandle->relDuration != handle->relDuration) { - HW_REG(PI_BSD_DOM1_RLS_REG, u32) = handle->relDuration; + IO_WRITE(PI_BSD_DOM1_RLS_REG, handle->relDuration); } if (curHandle->pulse != handle->pulse) { - HW_REG(PI_BSD_DOM1_PWD_REG, u32) = handle->pulse; + IO_WRITE(PI_BSD_DOM1_PWD_REG, handle->pulse); } } else { if (curHandle->latency != handle->latency) { - HW_REG(PI_BSD_DOM2_LAT_REG, u32) = handle->latency; + IO_WRITE(PI_BSD_DOM2_LAT_REG, handle->latency); } if (curHandle->pageSize != handle->pageSize) { - HW_REG(PI_BSD_DOM2_PGS_REG, u32) = handle->pageSize; + IO_WRITE(PI_BSD_DOM2_PGS_REG, handle->pageSize); } if (curHandle->relDuration != handle->relDuration) { - HW_REG(PI_BSD_DOM2_RLS_REG, u32) = handle->relDuration; + IO_WRITE(PI_BSD_DOM2_RLS_REG, handle->relDuration); } if (curHandle->pulse != handle->pulse) { - HW_REG(PI_BSD_DOM2_PWD_REG, u32) = handle->pulse; + IO_WRITE(PI_BSD_DOM2_PWD_REG, handle->pulse); } } @@ -52,6 +52,6 @@ s32 __osEPiRawReadIo(OSPiHandle* handle, uintptr_t devAddr, u32* data) { curHandle->pulse = handle->pulse; } - *data = HW_REG(handle->baseAddress | devAddr, u32); + *data = IO_READ(handle->baseAddress | devAddr); return 0; } diff --git a/src/libultra/io/epirawwrite.c b/src/libultra/io/epirawwrite.c index fe8ce81c5..946400ca7 100644 --- a/src/libultra/io/epirawwrite.c +++ b/src/libultra/io/epirawwrite.c @@ -1,45 +1,45 @@ -#include "global.h" +#include "ultra64.h" s32 __osEPiRawWriteIo(OSPiHandle* handle, uintptr_t devAddr, u32 data) { s32 status; OSPiHandle* curHandle; - while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) {} + while (status = IO_READ(PI_STATUS_REG), status & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) {} if (__osCurrentHandle[handle->domain]->type != handle->type) { curHandle = __osCurrentHandle[handle->domain]; if (handle->domain == 0) { if (curHandle->latency != handle->latency) { - HW_REG(PI_BSD_DOM1_LAT_REG, u32) = handle->latency; + IO_WRITE(PI_BSD_DOM1_LAT_REG, handle->latency); } if (curHandle->pageSize != handle->pageSize) { - HW_REG(PI_BSD_DOM1_PGS_REG, u32) = handle->pageSize; + IO_WRITE(PI_BSD_DOM1_PGS_REG, handle->pageSize); } if (curHandle->relDuration != handle->relDuration) { - HW_REG(PI_BSD_DOM1_RLS_REG, u32) = handle->relDuration; + IO_WRITE(PI_BSD_DOM1_RLS_REG, handle->relDuration); } if (curHandle->pulse != handle->pulse) { - HW_REG(PI_BSD_DOM1_PWD_REG, u32) = handle->pulse; + IO_WRITE(PI_BSD_DOM1_PWD_REG, handle->pulse); } } else { if (curHandle->latency != handle->latency) { - HW_REG(PI_BSD_DOM2_LAT_REG, u32) = handle->latency; + IO_WRITE(PI_BSD_DOM2_LAT_REG, handle->latency); } if (curHandle->pageSize != handle->pageSize) { - HW_REG(PI_BSD_DOM2_PGS_REG, u32) = handle->pageSize; + IO_WRITE(PI_BSD_DOM2_PGS_REG, handle->pageSize); } if (curHandle->relDuration != handle->relDuration) { - HW_REG(PI_BSD_DOM2_RLS_REG, u32) = handle->relDuration; + IO_WRITE(PI_BSD_DOM2_RLS_REG, handle->relDuration); } if (curHandle->pulse != handle->pulse) { - HW_REG(PI_BSD_DOM2_PWD_REG, u32) = handle->pulse; + IO_WRITE(PI_BSD_DOM2_PWD_REG, handle->pulse); } } @@ -50,6 +50,6 @@ s32 __osEPiRawWriteIo(OSPiHandle* handle, uintptr_t devAddr, u32 data) { curHandle->pulse = handle->pulse; } - HW_REG(handle->baseAddress | devAddr, u32) = data; + IO_WRITE(handle->baseAddress | devAddr, data); return 0; } diff --git a/src/libultra/io/epiread.c b/src/libultra/io/epiread.c index 5a2205bdc..f7f6ac1f9 100644 --- a/src/libultra/io/epiread.c +++ b/src/libultra/io/epiread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 osEPiReadIo(OSPiHandle* handle, uintptr_t devAddr, u32* data) { register s32 ret; diff --git a/src/libultra/io/epiwrite.c b/src/libultra/io/epiwrite.c index 213250741..00b97e85a 100644 --- a/src/libultra/io/epiwrite.c +++ b/src/libultra/io/epiwrite.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 osEPiWriteIo(OSPiHandle* handle, uintptr_t devAddr, u32 data) { register s32 ret; diff --git a/src/libultra/io/motor.c b/src/libultra/io/motor.c index ba934d800..343047e7b 100644 --- a/src/libultra/io/motor.c +++ b/src/libultra/io/motor.c @@ -1,7 +1,6 @@ +#include "ultra64.h" #include "PR/os_motor.h" - #include "PR/controller.h" -#include "functions.h" #define BANK_ADDR 0x400 #define MOTOR_ID 0x80 diff --git a/src/libultra/io/pfsallocatefile.c b/src/libultra/io/pfsallocatefile.c index 821568b87..aeced23ee 100644 --- a/src/libultra/io/pfsallocatefile.c +++ b/src/libultra/io/pfsallocatefile.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "global.h" +#include "PR/controller.h" s32 osPfsAllocateFile(OSPfs* pfs, u16 companyCode, u32 gameCode, u8* gameName, u8* extName, s32 fileSize, s32* fileNo) { s32 startPage; diff --git a/src/libultra/io/pfschecker.c b/src/libultra/io/pfschecker.c index 79045ce1b..f9ffb7ebf 100644 --- a/src/libultra/io/pfschecker.c +++ b/src/libultra/io/pfschecker.c @@ -1,5 +1,5 @@ -#include "PR/os_pfs.h" -#include "global.h" +#include "ultra64.h" +#include "PR/controller.h" #define CHECK_IPAGE(p) \ (((p).ipage >= pfs->inodeStartPage) && ((p).inode_t.bank < pfs->banks) && ((p).inode_t.page >= 0x01) && \ diff --git a/src/libultra/io/pfsdeletefile.c b/src/libultra/io/pfsdeletefile.c index 3d6558a0d..7dd9abca0 100644 --- a/src/libultra/io/pfsdeletefile.c +++ b/src/libultra/io/pfsdeletefile.c @@ -1,5 +1,5 @@ -#include "PR/os_pfs.h" -#include "global.h" +#include "ultra64.h" +#include "PR/controller.h" s32 __osPfsReleasePages(OSPfs* pfs, __OSInode* inode, u8 initialPage, u8 bank, __OSInodeUnit* finalPage); diff --git a/src/libultra/io/pfsfilestate.c b/src/libultra/io/pfsfilestate.c index 887eac1f6..a39d55c02 100644 --- a/src/libultra/io/pfsfilestate.c +++ b/src/libultra/io/pfsfilestate.c @@ -1,5 +1,6 @@ -#include "PR/os_pfs.h" -#include "global.h" +#include "ultra64.h" +#include "PR/controller.h" +#include "libc/stdbool.h" s32 osPfsFileState(OSPfs* pfs, s32 fileNo, OSPfsState* state) { s32 ret; diff --git a/src/libultra/io/pfsfreeblocks.c b/src/libultra/io/pfsfreeblocks.c index 2f8c6493f..9bf79cfe8 100644 --- a/src/libultra/io/pfsfreeblocks.c +++ b/src/libultra/io/pfsfreeblocks.c @@ -1,5 +1,5 @@ -#include "global.h" -#include "PR/os_pfs.h" +#include "ultra64.h" +#include "PR/controller.h" s32 osPfsFreeBlocks(OSPfs* pfs, s32* leftoverBytes) { s32 j; diff --git a/src/libultra/io/pfsgetstatus.c b/src/libultra/io/pfsgetstatus.c index 1d8e6dcf5..116b340f7 100644 --- a/src/libultra/io/pfsgetstatus.c +++ b/src/libultra/io/pfsgetstatus.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "global.h" +#include "PR/controller.h" void __osPfsRequestOneChannel(s32 channel, u8 poll); void __osPfsGetOneChannelData(s32 channel, OSContStatus* contData); diff --git a/src/libultra/io/pfsinitpak.c b/src/libultra/io/pfsinitpak.c index f4d917b62..2688bd5d8 100644 --- a/src/libultra/io/pfsinitpak.c +++ b/src/libultra/io/pfsinitpak.c @@ -1,5 +1,5 @@ -#include "PR/os_pfs.h" -#include "global.h" +#include "ultra64.h" +#include "PR/controller.h" s32 __osPfsCheckRamArea(OSPfs* pfs); diff --git a/src/libultra/io/pfsisplug.c b/src/libultra/io/pfsisplug.c index 99a2cbc42..e93c812d3 100644 --- a/src/libultra/io/pfsisplug.c +++ b/src/libultra/io/pfsisplug.c @@ -1,6 +1,9 @@ #include "PR/os_pfs.h" #include "PR/controller.h" -#include "global.h" +#include "PR/siint.h" +#include "alignment.h" + +OSPifRam __osPfsPifRam ALIGNED(16); void __osPfsRequestData(u8 poll); void __osPfsGetInitData(u8* pattern, OSContStatus* contData); @@ -50,40 +53,40 @@ s32 osPfsIsPlug(OSMesgQueue* mq, u8* pattern) { void __osPfsRequestData(u8 poll) { u8* bufPtr = (u8*)&__osPfsPifRam; - __OSContRequestHeader req; + __OSContRequesFormat req; s32 i; __osContLastPoll = poll; - __osPfsPifRam.status = 1; + __osPfsPifRam.status = CONT_CMD_EXE; - req.align = 0xFF; - req.txsize = 1; - req.rxsize = 3; + req.align = CONT_CMD_NOP; + req.txsize = CONT_CMD_REQUEST_STATUS_TX; + req.rxsize = CONT_CMD_REQUEST_STATUS_RX; req.poll = poll; - req.typeh = 0xFF; - req.typel = 0xFF; - req.status = 0xFF; - req.align1 = 0xFF; + req.typeh = CONT_CMD_NOP; + req.typel = CONT_CMD_NOP; + req.status = CONT_CMD_NOP; + req.align1 = CONT_CMD_NOP; for (i = 0; i < __osMaxControllers; i++) { - *((__OSContRequestHeader*)bufPtr) = req; - bufPtr += sizeof(req); + *(__OSContRequesFormat*)bufPtr = req; + bufPtr += sizeof(__OSContRequesFormat); } - *((u8*)bufPtr) = CONT_CMD_END; + *bufPtr = CONT_CMD_END; } void __osPfsGetInitData(u8* pattern, OSContStatus* contData) { u8* bufptr; - __OSContRequestHeader req; + __OSContRequesFormat req; s32 i; u8 bits = 0; bufptr = (u8*)&__osPfsPifRam; for (i = 0; i < __osMaxControllers; i++, bufptr += sizeof(req), contData++) { - req = *((__OSContRequestHeader*)bufptr); - contData->errno = ((req.rxsize & 0xC0) >> 4); + req = *(__OSContRequesFormat*)bufptr; + contData->errno = CHNL_ERR(req); if (contData->errno) { continue; diff --git a/src/libultra/io/pfsreadwritefile.c b/src/libultra/io/pfsreadwritefile.c index b5ab6e4b4..2d26e0013 100644 --- a/src/libultra/io/pfsreadwritefile.c +++ b/src/libultra/io/pfsreadwritefile.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "global.h" +#include "PR/controller.h" #define CHECK_IPAGE(p, pfs) \ (((p).ipage >= (pfs).inodeStartPage) && ((p).inode_t.bank < (pfs).banks) && ((p).inode_t.page >= 0x01) && \ diff --git a/src/libultra/io/pfssearchfile.c b/src/libultra/io/pfssearchfile.c index c5f8bcce4..1a034b7f0 100644 --- a/src/libultra/io/pfssearchfile.c +++ b/src/libultra/io/pfssearchfile.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "ultra64.h" +#include "PR/controller.h" s32 osPfsFindFile(OSPfs* pfs, u16 companyCode, u32 gameCode, u8* gameName, u8* extName, s32* fileNo) { s32 j; diff --git a/src/libultra/io/pfsselectbank.c b/src/libultra/io/pfsselectbank.c index 59a69fccb..380cbf10a 100644 --- a/src/libultra/io/pfsselectbank.c +++ b/src/libultra/io/pfsselectbank.c @@ -1,5 +1,5 @@ -#include "PR/os_pfs.h" -#include "global.h" +#include "ultra64.h" +#include "PR/controller.h" s32 __osPfsSelectBank(OSPfs* pfs, u8 bank) { u8 buf[BLOCKSIZE]; diff --git a/src/libultra/io/piacs.c b/src/libultra/io/piacs.c index f1107b758..08346578e 100644 --- a/src/libultra/io/piacs.c +++ b/src/libultra/io/piacs.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "ultra64.h" +#include "macros.h" u32 __osPiAccessQueueEnabled = 0; @@ -13,6 +14,7 @@ void __osPiCreateAccessQueue(void) { void __osPiGetAccess(void) { OSMesg dummyMesg; + if (!__osPiAccessQueueEnabled) { __osPiCreateAccessQueue(); } diff --git a/src/libultra/io/pigetcmdq.c b/src/libultra/io/pigetcmdq.c index 6d367200b..917881f70 100644 --- a/src/libultra/io/pigetcmdq.c +++ b/src/libultra/io/pigetcmdq.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" OSMesgQueue* osPiGetCmdQueue(void) { if (!__osPiDevMgr.active) { diff --git a/src/libultra/io/pimgr.c b/src/libultra/io/pimgr.c index b6e1fea13..dfde5007c 100644 --- a/src/libultra/io/pimgr.c +++ b/src/libultra/io/pimgr.c @@ -1,13 +1,19 @@ -#include "global.h" +#include "ultra64.h" +#include "alignment.h" #include "stack.h" +#include "macros.h" -OSPiHandle __Dom1SpeedParam; -OSPiHandle __Dom2SpeedParam; +OSPiHandle __Dom1SpeedParam ALIGNED(8); +OSPiHandle __Dom2SpeedParam ALIGNED(8); OSThread sPiMgrThread; STACK(sPiMgrStack, 0x1000); -OSMesgQueue piEventQueue; +OSMesgQueue piEventQueue ALIGNED(8); OSMesg piEventBuf[1]; +OSDevMgr __osPiDevMgr = { 0 }; +OSPiHandle* __osPiTable = NULL; +OSPiHandle* __osCurrentHandle[2] ALIGNED(8) = { &__Dom1SpeedParam, &__Dom2SpeedParam }; + void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgCnt) { u32 savedMask; OSPri oldPri; diff --git a/src/libultra/io/pirawdma.c b/src/libultra/io/pirawdma.c index b33afddfc..905ab1348 100644 --- a/src/libultra/io/pirawdma.c +++ b/src/libultra/io/pirawdma.c @@ -1,22 +1,22 @@ -#include "global.h" +#include "ultra64.h" s32 __osPiRawStartDma(s32 direction, uintptr_t devAddr, void* dramAddr, size_t size) { - register int status = HW_REG(PI_STATUS_REG, u32); + register int status = IO_READ(PI_STATUS_REG); while (status & (PI_STATUS_IO_BUSY | PI_STATUS_DMA_BUSY)) { - status = HW_REG(PI_STATUS_REG, u32); + status = IO_READ(PI_STATUS_REG); } - HW_REG(PI_DRAM_ADDR_REG, u32) = osVirtualToPhysical(dramAddr); + IO_WRITE(PI_DRAM_ADDR_REG, osVirtualToPhysical(dramAddr)); - HW_REG(PI_CART_ADDR_REG, u32) = (((uintptr_t)osRomBase | devAddr) & 0x1FFFFFFF); + IO_WRITE(PI_CART_ADDR_REG, K1_TO_PHYS((uintptr_t)osRomBase | devAddr)); switch (direction) { case OS_READ: - HW_REG(PI_WR_LEN_REG, u32) = size - 1; + IO_WRITE(PI_WR_LEN_REG, size - 1); break; case OS_WRITE: - HW_REG(PI_RD_LEN_REG, u32) = size - 1; + IO_WRITE(PI_RD_LEN_REG, size - 1); break; default: return -1; diff --git a/src/libultra/io/si.c b/src/libultra/io/si.c index 563c68276..f1511c0d6 100644 --- a/src/libultra/io/si.c +++ b/src/libultra/io/si.c @@ -1,7 +1,8 @@ -#include "global.h" +#include "ultra64.h" +#include "libc/stdbool.h" s32 __osSiDeviceBusy() { - register u32 status = HW_REG(SI_STATUS_REG, u32); + register u32 status = IO_READ(SI_STATUS_REG); if (status & (SI_STATUS_DMA_BUSY | SI_STATUS_IO_READ_BUSY)) { return true; diff --git a/src/libultra/io/siacs.c b/src/libultra/io/siacs.c index 7a221408e..6a99d8dd1 100644 --- a/src/libultra/io/siacs.c +++ b/src/libultra/io/siacs.c @@ -1,9 +1,11 @@ -#include "global.h" +#include "ultra64.h" +#include "alignment.h" +#include "macros.h" u32 __osSiAccessQueueEnabled = 0; -OSMesg siAccessBuf[1]; -OSMesgQueue __osSiAccessQueue; +OSMesg siAccessBuf[1] ALIGNED(8); +OSMesgQueue __osSiAccessQueue ALIGNED(8); void __osSiCreateAccessQueue() { __osSiAccessQueueEnabled = 1; @@ -13,6 +15,7 @@ void __osSiCreateAccessQueue() { void __osSiGetAccess(void) { OSMesg dummyMesg; + if (!__osSiAccessQueueEnabled) { __osSiCreateAccessQueue(); } diff --git a/src/libultra/io/sirawdma.c b/src/libultra/io/sirawdma.c index 08a347cc9..4c5dc8cc9 100644 --- a/src/libultra/io/sirawdma.c +++ b/src/libultra/io/sirawdma.c @@ -1,7 +1,8 @@ -#include "global.h" +#include "ultra64.h" +#include "alignment.h" s32 __osSiRawStartDma(s32 direction, void* dramAddr) { - if (HW_REG(SI_STATUS_REG, u32) & (SI_STATUS_DMA_BUSY | SI_STATUS_IO_READ_BUSY)) { + if (IO_READ(SI_STATUS_REG) & (SI_STATUS_DMA_BUSY | SI_STATUS_IO_READ_BUSY)) { return -1; } @@ -9,12 +10,12 @@ s32 __osSiRawStartDma(s32 direction, void* dramAddr) { osWritebackDCache(dramAddr, ALIGN16(PIF_RAM_END - PIF_RAM_START)); } - HW_REG(SI_DRAM_ADDR_REG, u32) = osVirtualToPhysical(dramAddr); + IO_WRITE(SI_DRAM_ADDR_REG, osVirtualToPhysical(dramAddr)); if (direction == OS_READ) { - HW_REG(SI_PIF_ADDR_RD64B_REG, void*) = (void*)PIF_RAM_START; + IO_WRITE(SI_PIF_ADDR_RD64B_REG, PIF_RAM_START); } else { - HW_REG(SI_PIF_ADDR_WR64B_REG, void*) = (void*)PIF_RAM_START; + IO_WRITE(SI_PIF_ADDR_WR64B_REG, PIF_RAM_START); } if (direction == OS_READ) { diff --git a/src/libultra/io/sirawread.c b/src/libultra/io/sirawread.c index 7e3537603..aca70e11b 100644 --- a/src/libultra/io/sirawread.c +++ b/src/libultra/io/sirawread.c @@ -1,9 +1,9 @@ -#include "global.h" +#include "ultra64.h" s32 __osSiRawReadIo(uintptr_t devAddr, u32* data) { if (__osSiDeviceBusy()) { return -1; } - *data = *(u32*)(devAddr | 0xA0000000); + *data = IO_READ(devAddr); return 0; } diff --git a/src/libultra/io/sirawwrite.c b/src/libultra/io/sirawwrite.c index 0f98b08c5..3175c5999 100644 --- a/src/libultra/io/sirawwrite.c +++ b/src/libultra/io/sirawwrite.c @@ -1,11 +1,11 @@ -#include "global.h" +#include "ultra64.h" s32 __osSiRawWriteIo(uintptr_t devAddr, u32 data) { - if (__osSiDeviceBusy() != 0) { + if (__osSiDeviceBusy()) { return -1; } - *(u32*)(devAddr | 0xA0000000) = data; + IO_WRITE(devAddr, data); return 0; } diff --git a/src/libultra/io/sp.c b/src/libultra/io/sp.c index c028c7692..e1d95eeb8 100644 --- a/src/libultra/io/sp.c +++ b/src/libultra/io/sp.c @@ -1,7 +1,8 @@ -#include "global.h" +#include "ultra64.h" +#include "libc/stdbool.h" s32 __osSpDeviceBusy(void) { - register u32 status = HW_REG(SP_STATUS_REG, u32); + register u32 status = IO_READ(SP_STATUS_REG); if (status & (SP_STATUS_DMA_BUSY | SP_STATUS_DMA_FULL | SP_STATUS_IO_FULL)) { return true; diff --git a/src/libultra/io/spgetstat.c b/src/libultra/io/spgetstat.c index 8987b2414..641261cf7 100644 --- a/src/libultra/io/spgetstat.c +++ b/src/libultra/io/spgetstat.c @@ -1,5 +1,5 @@ -#include "global.h" +#include "ultra64.h" u32 __osSpGetStatus() { - return HW_REG(SP_STATUS_REG, u32); + return IO_READ(SP_STATUS_REG); } diff --git a/src/libultra/io/sprawdma.c b/src/libultra/io/sprawdma.c index 494f3db50..b09eff34d 100644 --- a/src/libultra/io/sprawdma.c +++ b/src/libultra/io/sprawdma.c @@ -1,17 +1,17 @@ -#include "global.h" +#include "ultra64.h" -s32 __osSpRawStartDma(s32 direction, void* devAddr, void* dramAddr, size_t size) { +s32 __osSpRawStartDma(s32 direction, u32 devAddr, void* dramAddr, size_t size) { if (__osSpDeviceBusy()) { return -1; } - HW_REG(SP_MEM_ADDR_REG, u32) = devAddr; - HW_REG(SP_DRAM_ADDR_REG, u32) = osVirtualToPhysical(dramAddr); + IO_WRITE(SP_MEM_ADDR_REG, devAddr); + IO_WRITE(SP_DRAM_ADDR_REG, osVirtualToPhysical(dramAddr)); if (direction == OS_READ) { - HW_REG(SP_WR_LEN_REG, u32) = size - 1; + IO_WRITE(SP_WR_LEN_REG, size - 1); } else { - HW_REG(SP_RD_LEN_REG, u32) = size - 1; + IO_WRITE(SP_RD_LEN_REG, size - 1); } return 0; diff --git a/src/libultra/io/spsetpc.c b/src/libultra/io/spsetpc.c index 2c3cc32ba..2789428db 100644 --- a/src/libultra/io/spsetpc.c +++ b/src/libultra/io/spsetpc.c @@ -1,13 +1,12 @@ -#include "global.h" +#include "ultra64.h" -s32 __osSpSetPc(void* pc) { - register u32 spStatus = HW_REG(SP_STATUS_REG, u32); +s32 __osSpSetPc(u32 pc) { + register u32 spStatus = IO_READ(SP_STATUS_REG); if (!(spStatus & SP_STATUS_HALT)) { return -1; - } else { - HW_REG(SP_PC_REG, void*) = pc; } + IO_WRITE(SP_PC_REG, pc); return 0; } diff --git a/src/libultra/io/spsetstat.c b/src/libultra/io/spsetstat.c index eb183eab4..558b88fcf 100644 --- a/src/libultra/io/spsetstat.c +++ b/src/libultra/io/spsetstat.c @@ -1,5 +1,5 @@ -#include "global.h" +#include "ultra64.h" void __osSpSetStatus(u32 data) { - HW_REG(SP_STATUS_REG, u32) = data; + IO_WRITE(SP_STATUS_REG, data); } diff --git a/src/libultra/io/sptask.c b/src/libultra/io/sptask.c index 8445f53b0..b261664f0 100644 --- a/src/libultra/io/sptask.c +++ b/src/libultra/io/sptask.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #define _osVirtualToPhysical(ptr) \ if (ptr != NULL) { \ @@ -33,19 +33,20 @@ void osSpTaskLoad(OSTask* intp) { intp->t.flags &= ~OS_TASK_YIELDED; if (tp->t.flags & OS_TASK_LOADABLE) { - tp->t.ucode = HW_REG((uintptr_t)intp->t.yieldDataPtr + OS_YIELD_DATA_SIZE - 4, u32); + tp->t.ucode = IO_READ((uintptr_t)intp->t.yieldDataPtr + OS_YIELD_DATA_SIZE - 4); } } + osWritebackDCache(tp, sizeof(OSTask)); __osSpSetStatus(SP_CLR_SIG0 | SP_CLR_SIG1 | SP_CLR_SIG2 | SP_SET_INTR_BREAK); - while (__osSpSetPc((void*)SP_IMEM_START) == -1) {} + while (__osSpSetPc(SP_IMEM_START) == -1) {} - while (__osSpRawStartDma(1, (void*)(SP_IMEM_START - sizeof(*tp)), tp, sizeof(OSTask)) == -1) {} + while (__osSpRawStartDma(1, (SP_IMEM_START - sizeof(*tp)), tp, sizeof(OSTask)) == -1) {} while (__osSpDeviceBusy()) {} - while (__osSpRawStartDma(1, (void*)SP_IMEM_START, tp->t.ucodeBoot, tp->t.ucodeBootSize) == -1) {} + while (__osSpRawStartDma(1, SP_IMEM_START, tp->t.ucodeBoot, tp->t.ucodeBootSize) == -1) {} } void osSpTaskStartGo(OSTask* tp) { diff --git a/src/libultra/io/sptaskyield.c b/src/libultra/io/sptaskyield.c index ce0819b34..0d3285d81 100644 --- a/src/libultra/io/sptaskyield.c +++ b/src/libultra/io/sptaskyield.c @@ -1,5 +1,5 @@ -#include "global.h" +#include "ultra64.h" void osSpTaskYield(void) { - __osSpSetStatus(0x400); + __osSpSetStatus(SP_SET_YIELD); } diff --git a/src/libultra/io/sptaskyielded.c b/src/libultra/io/sptaskyielded.c index 66b541921..88c112305 100644 --- a/src/libultra/io/sptaskyielded.c +++ b/src/libultra/io/sptaskyielded.c @@ -1,17 +1,17 @@ -#include "global.h" +#include "ultra64.h" OSYieldResult osSpTaskYielded(OSTask* task) { - s32 status; + s32 status = __osSpGetStatus(); OSYieldResult result; - status = __osSpGetStatus(); - if (status & 0x100) { - result = 1; + + if (status & SP_STATUS_YIELDED) { + result = OS_TASK_YIELDED; } else { result = 0; } - if (status & 0x80) { + if (status & SP_STATUS_YIELD) { task->t.flags |= result; - task->t.flags &= ~(2); + task->t.flags &= ~OS_TASK_DP_WAIT; } return result; } diff --git a/src/libultra/io/vi.c b/src/libultra/io/vi.c index a1e3e77c4..e4bdfe559 100644 --- a/src/libultra/io/vi.c +++ b/src/libultra/io/vi.c @@ -1,6 +1,7 @@ -#include "global.h" +#include "ultra64.h" +#include "alignment.h" -static __OSViContext vi[2] = { 0 }; +static __OSViContext vi[2] ALIGNED(8) = { 0 }; __OSViContext* __osViCurr = &vi[0]; __OSViContext* __osViNext = &vi[1]; @@ -10,8 +11,8 @@ void __osViInit(void) { __osViNext = &vi[1]; __osViNext->retraceCount = 1; __osViCurr->retraceCount = 1; - __osViNext->buffer = (void*)0x80000000; - __osViCurr->buffer = (void*)0x80000000; + __osViNext->buffer = (void*)K0BASE; + __osViCurr->buffer = (void*)K0BASE; if (osTvType == OS_TV_PAL) { __osViNext->modep = &osViModePalLan1; @@ -24,9 +25,9 @@ void __osViInit(void) { __osViNext->state = 0x20; __osViNext->features = __osViNext->modep->comRegs.ctrl; - while (HW_REG(VI_CURRENT_REG, u32) > 10) {} + while (IO_READ(VI_CURRENT_REG) > 10) {} - HW_REG(VI_STATUS_REG, u32) = 0; + IO_WRITE(VI_STATUS_REG, 0); __osViSwapContext(); } diff --git a/src/libultra/io/viblack.c b/src/libultra/io/viblack.c index 6b8fec953..60f62aec1 100644 --- a/src/libultra/io/viblack.c +++ b/src/libultra/io/viblack.c @@ -1,14 +1,12 @@ -#include "global.h" +#include "ultra64.h" void osViBlack(u8 active) { - register u32 saveMask; - - saveMask = __osDisableInt(); + register u32 saveMask = __osDisableInt(); if (active) { - __osViNext->state |= 0x20; + __osViNext->state |= VI_STATE_BLACK; } else { - __osViNext->state &= ~0x20; + __osViNext->state &= ~VI_STATE_BLACK; } __osRestoreInt(saveMask); diff --git a/src/libultra/io/viextendvstart.c b/src/libultra/io/viextendvstart.c new file mode 100644 index 000000000..a28a8386d --- /dev/null +++ b/src/libultra/io/viextendvstart.c @@ -0,0 +1,5 @@ +#include "ultra64.h" + +void osViExtendVStart(u32 value) { + __additional_scanline = value; +} diff --git a/src/libultra/io/vigetcurrcontext.c b/src/libultra/io/vigetcurrcontext.c index 2b7de8341..3bb95fb4f 100644 --- a/src/libultra/io/vigetcurrcontext.c +++ b/src/libultra/io/vigetcurrcontext.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" __OSViContext* __osViGetCurrentContext(void) { return __osViCurr; diff --git a/src/libultra/io/vigetcurrframebuf.c b/src/libultra/io/vigetcurrframebuf.c index 8127a3f63..f0caeb7b1 100644 --- a/src/libultra/io/vigetcurrframebuf.c +++ b/src/libultra/io/vigetcurrframebuf.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void* osViGetCurrentFramebuffer(void) { register u32 prevInt = __osDisableInt(); diff --git a/src/libultra/io/vigetnextframebuf.c b/src/libultra/io/vigetnextframebuf.c index 21fd8ece7..af6fb3179 100644 --- a/src/libultra/io/vigetnextframebuf.c +++ b/src/libultra/io/vigetnextframebuf.c @@ -1,11 +1,9 @@ -#include "global.h" +#include "ultra64.h" void* osViGetNextFramebuffer(void) { - register u32 saveMask; + register u32 saveMask = __osDisableInt(); void* buffer; - saveMask = __osDisableInt(); - buffer = __osViNext->buffer; __osRestoreInt(saveMask); diff --git a/src/libultra/io/vimgr.c b/src/libultra/io/vimgr.c index 7bdb3ac51..485bdf597 100644 --- a/src/libultra/io/vimgr.c +++ b/src/libultra/io/vimgr.c @@ -1,14 +1,17 @@ -#include "global.h" +#include "ultra64.h" #include "PR/osint.h" #include "stack.h" #include "PR/osint.h" +#include "libc/stdbool.h" +#include "macros.h" +#include "alignment.h" OSThread viThread; -STACK(sViStack, 0x1000); -OSMesgQueue viEventQueue; -OSMesg viEventBuf[6]; -OSIoMesg viRetraceMsg; -OSIoMesg viCounterMsg; +STACK(sViStack, OS_VIM_STACKSIZE) ALIGNED(16); +OSMesgQueue viEventQueue ALIGNED(8); +OSMesg viEventBuf[6] ALIGNED(8); +OSIoMesg viRetraceMsg ALIGNED(8); +OSIoMesg viCounterMsg ALIGNED(8); OSDevMgr __osViDevMgr = { 0 }; u32 __additional_scanline = 0; @@ -57,8 +60,8 @@ void osCreateViManager(OSPri pri) { } } -void viMgrMain(void* vargs) { - OSMgrArgs* args; +void viMgrMain(void* arg) { + OSDevMgr* dmArgs; static u16 viRetrace; u32 addTime; OSIoMesg* mesg; @@ -70,10 +73,10 @@ void viMgrMain(void* vargs) { viRetrace = 1; } - args = (OSMgrArgs*)vargs; + dmArgs = (OSDevMgr*)arg; while (true) { - osRecvMesg(args->eventQueue, (OSMesg*)&mesg, OS_MESG_BLOCK); + osRecvMesg(dmArgs->evtQueue, (OSMesg*)&mesg, OS_MESG_BLOCK); switch (mesg->hdr.type) { case OS_MESG_TYPE_VRETRACE: __osViSwapContext(); diff --git a/src/libultra/gu/visetevent.c b/src/libultra/io/visetevent.c similarity index 91% rename from src/libultra/gu/visetevent.c rename to src/libultra/io/visetevent.c index 3a14ccbc1..701f41863 100644 --- a/src/libultra/gu/visetevent.c +++ b/src/libultra/io/visetevent.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void osViSetEvent(OSMesgQueue* mq, OSMesg m, u32 retraceCount) { register u32 saveMask = __osDisableInt(); diff --git a/src/libultra/io/visetmode.c b/src/libultra/io/visetmode.c index 6953bf63b..6117b06a2 100644 --- a/src/libultra/io/visetmode.c +++ b/src/libultra/io/visetmode.c @@ -1,12 +1,10 @@ -#include "global.h" +#include "ultra64.h" void osViSetMode(OSViMode* modep) { - register u32 saveMask; - - saveMask = __osDisableInt(); + register u32 saveMask = __osDisableInt(); __osViNext->modep = modep; - __osViNext->state = 1; + __osViNext->state = VI_STATE_MODE_UPDATED; __osViNext->features = __osViNext->modep->comRegs.ctrl; __osRestoreInt(saveMask); diff --git a/src/libultra/io/visetspecial.c b/src/libultra/io/visetspecial.c index a5ef1220a..758807b1b 100644 --- a/src/libultra/io/visetspecial.c +++ b/src/libultra/io/visetspecial.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void osViSetSpecialFeatures(u32 func) { register u32 saveMask = __osDisableInt(); diff --git a/src/libultra/io/visetxscale.c b/src/libultra/io/visetxscale.c index 0e2cf762d..94f192b87 100644 --- a/src/libultra/io/visetxscale.c +++ b/src/libultra/io/visetxscale.c @@ -1,17 +1,15 @@ -#include "global.h" +#include "ultra64.h" void osViSetXScale(f32 value) { register u32 nomValue; - register u32 saveMask; - - saveMask = __osDisableInt(); + register u32 saveMask = __osDisableInt(); __osViNext->x.factor = value; - __osViNext->state |= 0x2; + __osViNext->state |= VI_STATE_XSCALE_UPDATED; - nomValue = __osViNext->modep->comRegs.xScale & 0xFFF; - __osViNext->x.scale = (u32)(__osViNext->x.factor * nomValue) & 0xFFF; + nomValue = __osViNext->modep->comRegs.xScale & VI_SCALE_MASK; + __osViNext->x.scale = (u32)(__osViNext->x.factor * nomValue) & VI_SCALE_MASK; __osRestoreInt(saveMask); } diff --git a/src/libultra/io/visetyscale.c b/src/libultra/io/visetyscale.c index 6ef85963d..093a61fa9 100644 --- a/src/libultra/io/visetyscale.c +++ b/src/libultra/io/visetyscale.c @@ -1,13 +1,11 @@ -#include "global.h" +#include "ultra64.h" void osViSetYScale(f32 value) { - register u32 saveMask; - - saveMask = __osDisableInt(); + register u32 saveMask = __osDisableInt(); __osViNext->y.factor = value; - __osViNext->state |= 0x4; + __osViNext->state |= VI_STATE_YSCALE_UPDATED; __osRestoreInt(saveMask); } diff --git a/src/libultra/io/viswapbuf.c b/src/libultra/io/viswapbuf.c index c60918092..dafce36f3 100644 --- a/src/libultra/io/viswapbuf.c +++ b/src/libultra/io/viswapbuf.c @@ -1,11 +1,11 @@ -#include "global.h" +#include "ultra64.h" void osViSwapBuffer(void* frameBufPtr) { u32 saveMask = __osDisableInt(); __osViNext->buffer = frameBufPtr; - __osViNext->state |= 0x10; + __osViNext->state |= VI_STATE_BUFFER_UPDATED; __osRestoreInt(saveMask); } diff --git a/src/libultra/io/viswapcontext.c b/src/libultra/io/viswapcontext.c index 514e3aa1d..b6e9a8c5f 100644 --- a/src/libultra/io/viswapcontext.c +++ b/src/libultra/io/viswapcontext.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void __osViSwapContext(void) { register OSViMode* viMode; @@ -8,15 +8,13 @@ void __osViSwapContext(void) { u32 vstart; u32 sp34; u32 field; - register u32 s2; field = 0; viNext = __osViNext; viMode = viNext->modep; - field = HW_REG(VI_V_CURRENT_LINE_REG, u32) & 1; - s2 = osVirtualToPhysical(viNext->buffer); - origin = (viMode->fldRegs[field].origin) + s2; - if (viNext->state & 2) { + field = IO_READ(VI_V_CURRENT_LINE_REG) & 1; + origin = osVirtualToPhysical(viNext->buffer) + viMode->fldRegs[field].origin; + if (viNext->state & VI_STATE_XSCALE_UPDATED) { viNext->x.scale |= viMode->comRegs.xScale & ~0xFFF; } else { viNext->x.scale = viMode->comRegs.xScale; @@ -46,19 +44,19 @@ void __osViSwapContext(void) { origin = osVirtualToPhysical(viNext->buffer); } - HW_REG(VI_ORIGIN_REG, u32) = origin; - HW_REG(VI_WIDTH_REG, u32) = viMode->comRegs.width; - HW_REG(VI_BURST_REG, u32) = viMode->comRegs.burst; - HW_REG(VI_V_SYNC_REG, u32) = viMode->comRegs.vSync; - HW_REG(VI_H_SYNC_REG, u32) = viMode->comRegs.hSync; - HW_REG(VI_LEAP_REG, u32) = viMode->comRegs.leap; - HW_REG(VI_H_START_REG, u32) = hStart; - HW_REG(VI_V_START_REG, u32) = vstart; - HW_REG(VI_V_BURST_REG, u32) = viMode->fldRegs[field].vBurst; - HW_REG(VI_INTR_REG, u32) = viMode->fldRegs[field].vIntr; - HW_REG(VI_X_SCALE_REG, u32) = viNext->x.scale; - HW_REG(VI_Y_SCALE_REG, u32) = viNext->y.scale; - HW_REG(VI_CONTROL_REG, u32) = viNext->features; + IO_WRITE(VI_ORIGIN_REG, origin); + IO_WRITE(VI_WIDTH_REG, viMode->comRegs.width); + IO_WRITE(VI_BURST_REG, viMode->comRegs.burst); + IO_WRITE(VI_V_SYNC_REG, viMode->comRegs.vSync); + IO_WRITE(VI_H_SYNC_REG, viMode->comRegs.hSync); + IO_WRITE(VI_LEAP_REG, viMode->comRegs.leap); + IO_WRITE(VI_H_START_REG, hStart); + IO_WRITE(VI_V_START_REG, vstart); + IO_WRITE(VI_V_BURST_REG, viMode->fldRegs[field].vBurst); + IO_WRITE(VI_INTR_REG, viMode->fldRegs[field].vIntr); + IO_WRITE(VI_X_SCALE_REG, viNext->x.scale); + IO_WRITE(VI_Y_SCALE_REG, viNext->y.scale); + IO_WRITE(VI_CONTROL_REG, viNext->features); __osViNext = __osViCurr; __osViCurr = viNext; diff --git a/src/libultra/libc/ldiv.c b/src/libultra/libc/ldiv.c index 9f9d75031..66b144da4 100644 --- a/src/libultra/libc/ldiv.c +++ b/src/libultra/libc/ldiv.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "ultra64.h" +#include "libc/stdlib.h" ldiv_t ldiv(long numer, long denom) { ldiv_t val; diff --git a/src/libultra/libc/ll.c b/src/libultra/libc/ll.c index 0fd42d1ed..a05917090 100644 --- a/src/libultra/libc/ll.c +++ b/src/libultra/libc/ll.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" long long __ull_rshift(unsigned long long left, unsigned long long right) { return left >> right; diff --git a/src/libultra/libc/llcvt.c b/src/libultra/libc/llcvt.c index 2ef487938..f78d88272 100644 --- a/src/libultra/libc/llcvt.c +++ b/src/libultra/libc/llcvt.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" long long __d_to_ll(double d) { return d; diff --git a/src/libultra/rmon/sprintf.c b/src/libultra/libc/sprintf.c similarity index 92% rename from src/libultra/rmon/sprintf.c rename to src/libultra/libc/sprintf.c index 9f3610fe0..773b982ff 100644 --- a/src/libultra/rmon/sprintf.c +++ b/src/libultra/libc/sprintf.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "ultra64.h" +#include "libc/stdlib.h" #include "libc/string.h" void* proutSprintf(void* dst, const char* fmt, size_t size) { diff --git a/src/libultra/libc/string.c b/src/libultra/libc/string.c index b23bf564d..b4bdf84ae 100644 --- a/src/libultra/libc/string.c +++ b/src/libultra/libc/string.c @@ -1,4 +1,6 @@ -#include "global.h" +#include "ultra64.h" +#include "libc/stdlib.h" +#include "libc/string.h" const char* strchr(const char* s, int c) { const unsigned char ch = c; diff --git a/src/libultra/rmon/xldtob.c b/src/libultra/libc/xldtob.c similarity index 99% rename from src/libultra/rmon/xldtob.c rename to src/libultra/libc/xldtob.c index e30bf4b81..df9c30a28 100644 --- a/src/libultra/rmon/xldtob.c +++ b/src/libultra/libc/xldtob.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "ultra64.h" +#include "libc/stdlib.h" #include "libc/string.h" #define BUFF_LEN 0x20 diff --git a/src/libultra/rmon/xlitob.c b/src/libultra/libc/xlitob.c similarity index 89% rename from src/libultra/rmon/xlitob.c rename to src/libultra/libc/xlitob.c index 70b9c32a4..9eb0e98d1 100644 --- a/src/libultra/rmon/xlitob.c +++ b/src/libultra/libc/xlitob.c @@ -1,14 +1,15 @@ -#include "global.h" +#include "ultra64.h" +#include "libc/stdlib.h" #include "libc/string.h" #define BUFF_LEN 0x18 -u8 ldigs[] = "0123456789abcdef"; -u8 udigs[] = "0123456789ABCDEF"; +char ldigs[] = "0123456789abcdef"; +char udigs[] = "0123456789ABCDEF"; void _Litob(_Pft* args, u8 type) { u8 buff[BUFF_LEN]; - const u8* numMap; + const char* numMap; s32 base; s32 idx; u64 num; diff --git a/src/libultra/rmon/xprintf.c b/src/libultra/libc/xprintf.c similarity index 99% rename from src/libultra/rmon/xprintf.c rename to src/libultra/libc/xprintf.c index 3fc6b5e2a..a4094833f 100644 --- a/src/libultra/rmon/xprintf.c +++ b/src/libultra/libc/xprintf.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "libc/string.h" #define ATOI(i, a) \ diff --git a/src/libultra/os/afterprenmi.c b/src/libultra/os/afterprenmi.c index b59814763..6a9a83de3 100644 --- a/src/libultra/os/afterprenmi.c +++ b/src/libultra/os/afterprenmi.c @@ -1,5 +1,4 @@ #include "ultra64.h" -#include "global.h" s32 osAfterPreNMI(void) { return __osSpSetPc(0); diff --git a/src/libultra/os/createmesgqueue.c b/src/libultra/os/createmesgqueue.c index bcbaf1c54..34f85f867 100644 --- a/src/libultra/os/createmesgqueue.c +++ b/src/libultra/os/createmesgqueue.c @@ -1,8 +1,8 @@ -#include "global.h" +#include "ultra64.h" void osCreateMesgQueue(OSMesgQueue* mq, OSMesg* msq, s32 count) { - mq->mtQueue = (OSThread*)&__osThreadTail; - mq->fullQueue = (OSThread*)&__osThreadTail; + mq->mtQueue = (OSThread*)&__osThreadTail.next; + mq->fullQueue = (OSThread*)&__osThreadTail.next; mq->validCount = 0; mq->first = 0; mq->msgCount = count; diff --git a/src/libultra/os/createthread.c b/src/libultra/os/createthread.c index e67743eb3..d0f3a7419 100644 --- a/src/libultra/os/createthread.c +++ b/src/libultra/os/createthread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void osCreateThread(OSThread* thread, OSId id, void* entry, void* arg, void* sp, OSPri p) { register u32 saveMask; @@ -13,12 +13,12 @@ void osCreateThread(OSThread* thread, OSId id, void* entry, void* arg, void* sp, thread->context.sp = (u64)(s32)sp - 16; thread->context.ra = __osCleanupThread; - mask = 0x3FFF01; - thread->context.sr = 0xFF03; - thread->context.rcp = (mask & 0x3F0000) >> 16; - thread->context.fpcsr = 0x01000800; + mask = OS_IM_ALL; + thread->context.sr = (mask & (SR_IMASK | SR_IE)) | SR_EXL; + thread->context.rcp = (mask & RCP_IMASK) >> RCP_IMASKSHIFT; + thread->context.fpcsr = (u32)(FPCSR_FS | FPCSR_EV); thread->fp = 0; - thread->state = 1; + thread->state = OS_STATE_STOPPED; thread->flags = 0; saveMask = __osDisableInt(); diff --git a/src/libultra/os/destroythread.c b/src/libultra/os/destroythread.c index 0e92d2fcf..4bb7c9f34 100644 --- a/src/libultra/os/destroythread.c +++ b/src/libultra/os/destroythread.c @@ -1,15 +1,13 @@ -#include "global.h" +#include "ultra64.h" void osDestroyThread(OSThread* t) { - register u32 saveMask; + register u32 saveMask = __osDisableInt(); register OSThread* pred; register OSThread* succ; - saveMask = __osDisableInt(); - if (t == NULL) { t = __osRunningThread; - } else if (t->state != 1) { + } else if (t->state != OS_STATE_STOPPED) { __osDequeueThread(t->queue, t); } diff --git a/src/libultra/os/getactivequeue.c b/src/libultra/os/getactivequeue.c index de55d7f04..633e01814 100644 --- a/src/libultra/os/getactivequeue.c +++ b/src/libultra/os/getactivequeue.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" OSThread* __osGetActiveQueue(void) { return __osActiveQueue; diff --git a/src/libultra/os/getcurrfaultthread.c b/src/libultra/os/getcurrfaultthread.c index f36799b26..bf2edb92d 100644 --- a/src/libultra/os/getcurrfaultthread.c +++ b/src/libultra/os/getcurrfaultthread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" OSThread* __osGetCurrFaultedThread(void) { return __osFaultedThread; diff --git a/src/libultra/os/gethwinterrupt.c b/src/libultra/os/gethwinterrupt.c index 711985df7..76366663c 100644 --- a/src/libultra/os/gethwinterrupt.c +++ b/src/libultra/os/gethwinterrupt.c @@ -1,8 +1,7 @@ -#include "global.h" #include "PR/os_internal.h" #include "PR/osint.h" -void __osGetHWIntrRoutine(OSHWIntr idx, OSMesgQueue** outQueue, OSMesg* outMsg) { - *outQueue = __osHwIntTable[idx].queue; - *outMsg = __osHwIntTable[idx].msg; +void __osGetHWIntrRoutine(OSHWIntr interrupt, s32 (**handler)(void), void** stackEnd) { + *handler = __osHwIntTable[interrupt].handler; + *stackEnd = __osHwIntTable[interrupt].stackEnd; } diff --git a/src/libultra/os/getmemsize.c b/src/libultra/os/getmemsize.c index e9a995f30..ea2702255 100644 --- a/src/libultra/os/getmemsize.c +++ b/src/libultra/os/getmemsize.c @@ -1,28 +1,33 @@ -#include "global.h" +#include "ultra64.h" + +#define STEP 0x100000 +#define SIZE_4MB 0x400000 +#define SIZE_8MB 0x800000 u32 osGetMemSize(void) { - u32* spC; - u32 sp8; - u32 sp4; - u32 sp0; + vu32* ptr; + u32 size = SIZE_4MB; + u32 data0; + u32 data1; - sp8 = 0x400000; + while (size < SIZE_8MB) { + ptr = (vu32*)(K1BASE + size); - do { - spC = (u32*)(sp8 + 0xA0000000); - sp4 = *(u32*)(0xA0000000 + sp8); - sp0 = *(u32*)(0xA00FFFFC + sp8); - *(u32*)(0xA0000000 + sp8) = *(u32*)(0xA0000000 + sp8) ^ 0xFFFFFFFF; - spC[0x000FFFFC / 4] = spC[0x000FFFFC / 4] ^ 0xFFFFFFFF; + data0 = *ptr; + data1 = ptr[STEP / 4 - 1]; - if ((spC[0] != (sp4 ^ 0xFFFFFFFF)) || (spC[0x000FFFFC / 4] != (sp0 ^ 0xFFFFFFFF))) { - return sp8; + *ptr ^= ~0; + ptr[STEP / 4 - 1] ^= ~0; + + if ((*ptr != (data0 ^ ~0)) || (ptr[STEP / 4 - 1] != (data1 ^ ~0))) { + return size; } - *spC = sp4; - spC[0x000FFFFC / 4] = sp0; - sp8 = sp8 + 0x100000; - } while (sp8 < 0x800000); + *ptr = data0; + ptr[STEP / 4 - 1] = data1; - return sp8; + size += STEP; + } + + return size; } diff --git a/src/libultra/os/getthreadid.c b/src/libultra/os/getthreadid.c index 57c8e275f..d77389880 100644 --- a/src/libultra/os/getthreadid.c +++ b/src/libultra/os/getthreadid.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" OSId osGetThreadId(OSThread* t) { if (t == NULL) { diff --git a/src/libultra/os/getthreadpri.c b/src/libultra/os/getthreadpri.c index ada853ffb..7ea51bb64 100644 --- a/src/libultra/os/getthreadpri.c +++ b/src/libultra/os/getthreadpri.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" OSPri osGetThreadPri(OSThread* t) { if (t == NULL) { diff --git a/src/libultra/os/gettime.c b/src/libultra/os/gettime.c index a29688a0a..4d5b044b1 100644 --- a/src/libultra/os/gettime.c +++ b/src/libultra/os/gettime.c @@ -1,18 +1,18 @@ -#include "global.h" +#include "ultra64.h" OSTime osGetTime(void) { u32 CurrentCount; u32 elapseCount; - OSTime sp28; + OSTime currentCount; register u32 savedMask; savedMask = __osDisableInt(); CurrentCount = osGetCount(); elapseCount = CurrentCount - __osBaseCounter; - sp28 = __osCurrentTime; + currentCount = __osCurrentTime; __osRestoreInt(savedMask); - return elapseCount + sp28; + return elapseCount + currentCount; } diff --git a/src/libultra/os/initialize.c b/src/libultra/os/initialize.c index 458aa55b9..a39aa91c0 100644 --- a/src/libultra/os/initialize.c +++ b/src/libultra/os/initialize.c @@ -1,8 +1,9 @@ -#include "global.h" +#include "ultra64.h" +#include "libc/stdbool.h" #define COLD_RESET 0 -typedef struct { +typedef struct __osExceptionVector { /* 0x0 */ u32 ins_00; // lui k0, 0x8000 /* 0x4 */ u32 ins_04; // addiu k0, k0, 0x39E0 /* 0x8 */ u32 ins_08; // jr k0 ; __osException @@ -14,22 +15,22 @@ extern __osExceptionVector __osExceptionPreamble; u64 osClockRate = OS_CLOCK_RATE; s32 osViClock = VI_NTSC_CLOCK; u32 __osShutdown = 0; -u32 __OSGlobalIntMask = 0x003FFF01; +u32 __OSGlobalIntMask = OS_IM_ALL; u32 __osFinalrom; void __createSpeedParam(void) { __Dom1SpeedParam.type = DEVICE_TYPE_INIT; - __Dom1SpeedParam.latency = HW_REG(PI_BSD_DOM1_LAT_REG, u32); - __Dom1SpeedParam.pulse = HW_REG(PI_BSD_DOM1_PWD_REG, u32); - __Dom1SpeedParam.pageSize = HW_REG(PI_BSD_DOM1_PGS_REG, u32); - __Dom1SpeedParam.relDuration = HW_REG(PI_BSD_DOM1_RLS_REG, u32); + __Dom1SpeedParam.latency = IO_READ(PI_BSD_DOM1_LAT_REG); + __Dom1SpeedParam.pulse = IO_READ(PI_BSD_DOM1_PWD_REG); + __Dom1SpeedParam.pageSize = IO_READ(PI_BSD_DOM1_PGS_REG); + __Dom1SpeedParam.relDuration = IO_READ(PI_BSD_DOM1_RLS_REG); __Dom2SpeedParam.type = DEVICE_TYPE_INIT; - __Dom2SpeedParam.latency = HW_REG(PI_BSD_DOM2_LAT_REG, u32); - __Dom2SpeedParam.pulse = HW_REG(PI_BSD_DOM2_PWD_REG, u32); - __Dom2SpeedParam.pageSize = HW_REG(PI_BSD_DOM2_PGS_REG, u32); - __Dom2SpeedParam.relDuration = HW_REG(PI_BSD_DOM2_RLS_REG, u32); + __Dom2SpeedParam.latency = IO_READ(PI_BSD_DOM2_LAT_REG); + __Dom2SpeedParam.pulse = IO_READ(PI_BSD_DOM2_PWD_REG); + __Dom2SpeedParam.pageSize = IO_READ(PI_BSD_DOM2_PGS_REG); + __Dom2SpeedParam.relDuration = IO_READ(PI_BSD_DOM2_RLS_REG); } void __osInitialize_common(void) { @@ -37,29 +38,29 @@ void __osInitialize_common(void) { __osFinalrom = 1; - __osSetSR(__osGetSR() | 0x20000000); - __osSetFpcCsr(0x01000800); + __osSetSR(__osGetSR() | SR_CU1); + __osSetFpcCsr(FPCSR_FS | FPCSR_EV); __osSetWatchLo(0x04900000); - while (__osSiRawReadIo(0x1FC007FC, &pifdata)) {} + while (__osSiRawReadIo(PIF_RAM_END - 3, &pifdata)) {} - while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8)) {} + while (__osSiRawWriteIo(PIF_RAM_END - 3, pifdata | 8)) {} - *(__osExceptionVector*)0x80000000 = __osExceptionPreamble; - *(__osExceptionVector*)0x80000080 = __osExceptionPreamble; - *(__osExceptionVector*)0x80000100 = __osExceptionPreamble; - *(__osExceptionVector*)0x80000180 = __osExceptionPreamble; + *(__osExceptionVector*)UT_VEC = __osExceptionPreamble; + *(__osExceptionVector*)XUT_VEC = __osExceptionPreamble; + *(__osExceptionVector*)ECC_VEC = __osExceptionPreamble; + *(__osExceptionVector*)E_VEC = __osExceptionPreamble; - osWritebackDCache(0x80000000, 400); - osInvalICache(0x80000000, 400); + osWritebackDCache((void*)UT_VEC, E_VEC - UT_VEC + sizeof(__osExceptionVector)); + osInvalICache((void*)UT_VEC, E_VEC - UT_VEC + sizeof(__osExceptionVector)); __createSpeedParam(); osUnmapTLBAll(); osMapTLBRdb(); - osClockRate = (u64)((osClockRate * 3LL) / 4ULL); + osClockRate = osClockRate * 3 / 4; if (osResetType == COLD_RESET) { - bzero(osAppNMIBuffer, 64); + bzero(osAppNMIBuffer, OS_APP_NMI_BUFSIZE); } if (osTvType == OS_TV_PAL) { @@ -70,13 +71,13 @@ void __osInitialize_common(void) { osViClock = VI_NTSC_CLOCK; } - if (__osGetCause() & 0x1000) { + if (__osGetCause() & CAUSE_IP5) { while (true) {} } - HW_REG(AI_CONTROL_REG, u32) = 1; - HW_REG(AI_DACRATE_REG, u32) = 0x3FFF; - HW_REG(AI_BITRATE_REG, u32) = 0xF; + IO_WRITE(AI_CONTROL_REG, AI_CONTROL_DMA_ON); + IO_WRITE(AI_DACRATE_REG, AI_MAX_DAC_RATE - 1); + IO_WRITE(AI_BITRATE_REG, AI_MAX_BIT_RATE - 1); } void __osInitialize_autodetect(void) { diff --git a/src/libultra/os/jammesg.c b/src/libultra/os/jammesg.c index e91753e2c..0baddad1c 100644 --- a/src/libultra/os/jammesg.c +++ b/src/libultra/os/jammesg.c @@ -1,13 +1,11 @@ -#include "global.h" +#include "ultra64.h" s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag) { - register u32 saveMask; - - saveMask = __osDisableInt(); + register u32 saveMask = __osDisableInt(); while (mq->validCount >= mq->msgCount) { - if (flag == 1) { - __osRunningThread->state = 8; + if (flag == OS_MESG_BLOCK) { + __osRunningThread->state = OS_STATE_WAITING; __osEnqueueAndYield(&mq->fullQueue); } else { __osRestoreInt(saveMask); diff --git a/src/libultra/os/recvmesg.c b/src/libultra/os/recvmesg.c index ec0b3f93b..03a399b9a 100644 --- a/src/libultra/os/recvmesg.c +++ b/src/libultra/os/recvmesg.c @@ -1,12 +1,10 @@ -#include "global.h" +#include "ultra64.h" s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flags) { - register u32 saveMask; + register u32 saveMask = __osDisableInt(); - saveMask = __osDisableInt(); - - while (mq->validCount == 0) { - if (flags == 0) { + while (MQ_IS_EMPTY(mq)) { + if (flags == OS_MESG_NOBLOCK) { __osRestoreInt(saveMask); return -1; } diff --git a/src/libultra/os/resetglobalintmask.c b/src/libultra/os/resetglobalintmask.c index 6289a1d4c..0cf5113a5 100644 --- a/src/libultra/os/resetglobalintmask.c +++ b/src/libultra/os/resetglobalintmask.c @@ -1,8 +1,8 @@ -#include "global.h" +#include "ultra64.h" void __osResetGlobalIntMask(OSHWIntr mask) { register s32 prevInt = __osDisableInt(); - __OSGlobalIntMask &= ~(mask & ~0x401); + __OSGlobalIntMask &= ~(mask & ~OS_IM_RCP); __osRestoreInt(prevInt); } diff --git a/src/libultra/os/sendmesg.c b/src/libultra/os/sendmesg.c index 6859c107b..b2ab18109 100644 --- a/src/libultra/os/sendmesg.c +++ b/src/libultra/os/sendmesg.c @@ -1,14 +1,12 @@ -#include "global.h" +#include "ultra64.h" s32 osSendMesg(OSMesgQueue* mq, OSMesg msg, s32 flags) { - register u32 saveMask; + register u32 saveMask = __osDisableInt(); register s32 last; - saveMask = __osDisableInt(); - - while (mq->validCount >= mq->msgCount) { - if (flags == 1) { - __osRunningThread->state = 8; + while (MQ_IS_FULL(mq)) { + if (flags == OS_MESG_BLOCK) { + __osRunningThread->state = OS_STATE_WAITING; __osEnqueueAndYield(&mq->fullQueue); } else { __osRestoreInt(saveMask); diff --git a/src/libultra/os/seteventmesg.c b/src/libultra/os/seteventmesg.c index 74258517f..6f4fb0f97 100644 --- a/src/libultra/os/seteventmesg.c +++ b/src/libultra/os/seteventmesg.c @@ -1,23 +1,22 @@ -#include "global.h" +#include "ultra64.h" #include "PR/osint.h" #include "libc/stdbool.h" +#include "alignment.h" u32 __osPreNMI = false; -__OSEventState __osEventStateTab[OS_NUM_EVENTS]; +__OSEventState __osEventStateTab[OS_NUM_EVENTS] ALIGNED(8); void osSetEventMesg(OSEvent e, OSMesgQueue* mq, OSMesg m) { - register u32 saveMask; + register u32 saveMask = __osDisableInt(); __OSEventState* es; - saveMask = __osDisableInt(); - es = &__osEventStateTab[e]; es->messageQueue = mq; es->message = m; - if (e == 14) { + if (e == OS_EVENT_PRENMI) { if (__osShutdown && !__osPreNMI) { osSendMesg(mq, m, OS_MESG_NOBLOCK); } diff --git a/src/libultra/os/setglobalintmask.c b/src/libultra/os/setglobalintmask.c index 067343f6e..42333ee2b 100644 --- a/src/libultra/os/setglobalintmask.c +++ b/src/libultra/os/setglobalintmask.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void __osSetGlobalIntMask(OSHWIntr mask) { register s32 prevInt = __osDisableInt(); diff --git a/src/libultra/os/sethwinterrupt.c b/src/libultra/os/sethwinterrupt.c index 4f536cade..3a42123f7 100644 --- a/src/libultra/os/sethwinterrupt.c +++ b/src/libultra/os/sethwinterrupt.c @@ -1,11 +1,11 @@ -#include "global.h" +#include "PR/os_internal.h" #include "PR/osint.h" -void __osSetHWIntrRoutine(OSHWIntr idx, OSMesgQueue* queue, OSMesg msg) { +void __osSetHWIntrRoutine(OSHWIntr interrupt, s32 (*handler)(void), void* stackEnd) { register s32 prevInt = __osDisableInt(); - __osHwIntTable[idx].queue = queue; - __osHwIntTable[idx].msg = msg; + __osHwIntTable[interrupt].handler = handler; + __osHwIntTable[interrupt].stackEnd = stackEnd; __osRestoreInt(prevInt); } diff --git a/src/libultra/os/setthreadpri.c b/src/libultra/os/setthreadpri.c index 2da5bf266..39ec0d159 100644 --- a/src/libultra/os/setthreadpri.c +++ b/src/libultra/os/setthreadpri.c @@ -1,9 +1,7 @@ -#include "global.h" +#include "ultra64.h" void osSetThreadPri(OSThread* thread, OSPri p) { - register u32 saveMask; - - saveMask = __osDisableInt(); + register u32 saveMask = __osDisableInt(); if (thread == NULL) { thread = __osRunningThread; @@ -12,13 +10,13 @@ void osSetThreadPri(OSThread* thread, OSPri p) { if (thread->priority != p) { thread->priority = p; - if (thread != __osRunningThread && thread->state != 1) { + if (thread != __osRunningThread && thread->state != OS_STATE_STOPPED) { __osDequeueThread(thread->queue, thread); __osEnqueueThread(thread->queue, thread); } if (__osRunningThread->priority < __osRunQueue->priority) { - __osRunningThread->state = 2; + __osRunningThread->state = OS_STATE_RUNNABLE; __osEnqueueAndYield(&__osRunQueue); } } diff --git a/src/libultra/os/settime.c b/src/libultra/os/settime.c index e6fc07bb4..fc4b77987 100644 --- a/src/libultra/os/settime.c +++ b/src/libultra/os/settime.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void osSetTime(OSTime ticks) { __osCurrentTime = ticks; diff --git a/src/libultra/os/settimer.c b/src/libultra/os/settimer.c index 77f568a02..5cf01c675 100644 --- a/src/libultra/os/settimer.c +++ b/src/libultra/os/settimer.c @@ -1,17 +1,17 @@ -#include "global.h" +#include "ultra64.h" -int osSetTimer(OSTimer* t, OSTime value, OSTime interval, OSMesgQueue* mq, OSMesg msg) { - OSTime tim; - OSTimer* spC; - u32 sp14; - u32 sp10; +int osSetTimer(OSTimer* t, OSTime countdown, OSTime interval, OSMesgQueue* mq, OSMesg msg) { + OSTime time; + OSTimer* next; + u32 count; + u32 value; u32 saveMask; t->next = NULL; t->prev = NULL; t->interval = interval; - if (value != 0) { - t->value = value; + if (countdown != 0) { + t->value = countdown; } else { t->value = interval; } @@ -20,21 +20,19 @@ int osSetTimer(OSTimer* t, OSTime value, OSTime interval, OSMesgQueue* mq, OSMes saveMask = __osDisableInt(); - if (__osTimerList->next != __osTimerList) { - //! FAKE: - if (1) {} - - spC = __osTimerList->next; - sp14 = osGetCount(); - sp10 = sp14 - __osTimerCounter; - if (sp10 < spC->value) { - spC->value -= sp10; + if (__osTimerList->next == __osTimerList) { + } else { + next = __osTimerList->next; + count = osGetCount(); + value = count - __osTimerCounter; + if (value < next->value) { + next->value -= value; } else { - spC->value = 1; + next->value = 1; } } - tim = __osInsertTimer(t); + time = __osInsertTimer(t); __osSetTimerIntr(__osTimerList->next->value); __osRestoreInt(saveMask); diff --git a/src/libultra/os/startthread.c b/src/libultra/os/startthread.c index fb19b67e2..259e5545c 100644 --- a/src/libultra/os/startthread.c +++ b/src/libultra/os/startthread.c @@ -1,21 +1,20 @@ -#include "global.h" +#include "ultra64.h" void osStartThread(OSThread* t) { - register u32 saveMask; - - saveMask = __osDisableInt(); + register u32 saveMask = __osDisableInt(); switch (t->state) { - case 8: - t->state = 2; + case OS_STATE_WAITING: + t->state = OS_STATE_RUNNABLE; __osEnqueueThread(&__osRunQueue, t); break; - case 1: + + case OS_STATE_STOPPED: if ((t->queue == NULL) || (t->queue == &__osRunQueue)) { - t->state = 2; + t->state = OS_STATE_RUNNABLE; __osEnqueueThread(&__osRunQueue, t); } else { - t->state = 8; + t->state = OS_STATE_WAITING; __osEnqueueThread(t->queue, t); __osEnqueueThread(&__osRunQueue, __osPopThread(t->queue)); } @@ -26,7 +25,7 @@ void osStartThread(OSThread* t) { __osDispatchThread(); } else { if (__osRunningThread->priority < __osRunQueue->priority) { - __osRunningThread->state = 2; + __osRunningThread->state = OS_STATE_RUNNABLE; __osEnqueueAndYield(&__osRunQueue); } } diff --git a/src/libultra/os/stopthread.c b/src/libultra/os/stopthread.c index 0fb388074..f4634326b 100644 --- a/src/libultra/os/stopthread.c +++ b/src/libultra/os/stopthread.c @@ -1,25 +1,24 @@ -#include "global.h" +#include "ultra64.h" void osStopThread(OSThread* t) { - register u32 saveMask; + register u32 saveMask = __osDisableInt(); register u16 state; - saveMask = __osDisableInt(); - if (t == NULL) { - state = 4; + state = OS_STATE_RUNNING; } else { state = t->state; } switch (state) { - case 4: - __osRunningThread->state = 1; + case OS_STATE_RUNNING: + __osRunningThread->state = OS_STATE_STOPPED; __osEnqueueAndYield(NULL); break; - case 2: - case 8: - t->state = 1; + + case OS_STATE_RUNNABLE: + case OS_STATE_WAITING: + t->state = OS_STATE_STOPPED; __osDequeueThread(t->queue, t); break; } diff --git a/src/libultra/os/stoptimer.c b/src/libultra/os/stoptimer.c index 70a483461..936a19af8 100644 --- a/src/libultra/os/stoptimer.c +++ b/src/libultra/os/stoptimer.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 osStopTimer(OSTimer* t) { register u32 savedMask; diff --git a/src/libultra/os/thread.c b/src/libultra/os/thread.c index 98d04ab54..cd0484b44 100644 --- a/src/libultra/os/thread.c +++ b/src/libultra/os/thread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" __OSThreadTail __osThreadTail = { NULL, OS_PRIORITY_THREADTAIL }; OSThread* __osRunQueue = (OSThread*)&__osThreadTail; diff --git a/src/libultra/os/threadsave.c b/src/libultra/os/threadsave.c index bcf79be8d..2f7abe20d 100644 --- a/src/libultra/os/threadsave.c +++ b/src/libultra/os/threadsave.c @@ -1,3 +1,3 @@ -#include "global.h" +#include "ultra64.h" OSThread __osThreadSave; diff --git a/src/libultra/os/timerintr.c b/src/libultra/os/timerintr.c index 69ac931e1..ae30b5cf7 100644 --- a/src/libultra/os/timerintr.c +++ b/src/libultra/os/timerintr.c @@ -1,12 +1,11 @@ -#include "global.h" +#include "ultra64.h" +#include "libc/stdbool.h" OSTimer __osBaseTimer; OSTime __osCurrentTime; u32 __osBaseCounter; u32 __osViIntrCount; u32 __osTimerCounter; -s32 D_8009E5C8[2]; // dummy bss padding required -OSPifRam __osPfsPifRam; OSTimer* __osTimerList = &__osBaseTimer; diff --git a/src/libultra/os/viextend.c b/src/libultra/os/viextend.c deleted file mode 100644 index ce9f718d0..000000000 --- a/src/libultra/os/viextend.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "global.h" - -void osViExtendVStart(u32 a0) { - __additional_scanline = a0; -} diff --git a/src/libultra/os/virtualtophysical.c b/src/libultra/os/virtualtophysical.c index 403ab5f4f..864f54eb8 100644 --- a/src/libultra/os/virtualtophysical.c +++ b/src/libultra/os/virtualtophysical.c @@ -1,14 +1,12 @@ -#include "PR/ultratypes.h" -#include "PR/osint.h" +#include "ultra64.h" #include "libc/stdint.h" -#include "global.h" -uintptr_t osVirtualToPhysical(void* virtualAddress) { - if (((uintptr_t)virtualAddress >= 0x80000000) && ((uintptr_t)virtualAddress < 0xA0000000)) { - return (uintptr_t)virtualAddress & 0x1FFFFFFF; - } else if (((uintptr_t)virtualAddress >= 0xA0000000) && ((uintptr_t)virtualAddress < 0xC0000000)) { - return (uintptr_t)virtualAddress & 0x1FFFFFFF; +uintptr_t osVirtualToPhysical(void* addr) { + if (IS_KSEG0(addr)) { + return K0_TO_PHYS(addr); + } else if (IS_KSEG1(addr)) { + return K1_TO_PHYS(addr); } else { - return __osProbeTLB(virtualAddress); + return __osProbeTLB(addr); } } diff --git a/src/libultra/os/yieldthread.c b/src/libultra/os/yieldthread.c index c49fd0f12..7fd4e2491 100644 --- a/src/libultra/os/yieldthread.c +++ b/src/libultra/os/yieldthread.c @@ -1,9 +1,9 @@ -#include "global.h" +#include "ultra64.h" void osYieldThread(void) { register u32 saveMask = __osDisableInt(); - __osRunningThread->state = 2; + __osRunningThread->state = OS_STATE_RUNNABLE; __osEnqueueAndYield(&__osRunQueue); __osRestoreInt(saveMask); diff --git a/src/libultra/vimodes/vimodefpallan1.c b/src/libultra/vimodes/vimodefpallan1.c new file mode 100644 index 000000000..125f0b5fc --- /dev/null +++ b/src/libultra/vimodes/vimodefpallan1.c @@ -0,0 +1,37 @@ +#include "PR/os.h" +#include "PR/rcp.h" +#include "PR/viint.h" + +OSViMode osViModeFpalLan1 = { + OS_VI_FPAL_LAN1, // type + { + // comRegs + VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | VI_CTRL_DIVOT_ON | VI_CTRL_ANTIALIAS_MODE_1 | + VI_CTRL_PIXEL_ADV_3, // ctrl + WIDTH(320), // width + BURST(58, 30, 4, 69), // burst + VSYNC(625), // vSync + HSYNC(3177, 23), // hSync + LEAP(3183, 3181), // leap + HSTART(128, 768), // hStart + SCALE(2, 0), // xScale + VCURRENT(0), // vCurrent + }, + { // fldRegs + { + // [0] + ORIGIN(640), // origin + SCALE(1, 0), // yScale + HSTART(47, 617), // vStart + BURST(107, 2, 9, 0), // vBurst + VINTR(2), // vIntr + }, + { + // [1] + ORIGIN(640), // origin + SCALE(1, 0), // yScale + HSTART(47, 617), // vStart + BURST(107, 2, 9, 0), // vBurst + VINTR(2), // vIntr + } }, +}; diff --git a/src/libultra/io/osViModeMpalLan1.c b/src/libultra/vimodes/vimodempallan1.c similarity index 52% rename from src/libultra/io/osViModeMpalLan1.c rename to src/libultra/vimodes/vimodempallan1.c index a7f5173a9..7e611fe9b 100644 --- a/src/libultra/io/osViModeMpalLan1.c +++ b/src/libultra/vimodes/vimodempallan1.c @@ -1,19 +1,21 @@ -#include "global.h" +#include "PR/os.h" +#include "PR/rcp.h" #include "PR/viint.h" OSViMode osViModeMpalLan1 = { OS_VI_MPAL_LAN1, // type { // comRegs - 0x311E, // ctrl - WIDTH(320), // width - BURST(57, 30, 5, 70), // burst - VSYNC(525), // vSync - HSYNC(3089, 4), // hSync - LEAP(3097, 3098), // leap - HSTART(108, 748), // hStart - SCALE(2, 0), // xScale - VCURRENT(0), // vCurrent + VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | VI_CTRL_DIVOT_ON | VI_CTRL_ANTIALIAS_MODE_1 | + VI_CTRL_PIXEL_ADV_3, // ctrl + WIDTH(320), // width + BURST(57, 30, 5, 70), // burst + VSYNC(525), // vSync + HSYNC(3089, 4), // hSync + LEAP(3097, 3098), // leap + HSTART(108, 748), // hStart + SCALE(2, 0), // xScale + VCURRENT(0), // vCurrent }, { // fldRegs { diff --git a/src/libultra/io/osViModeNtscHpf1.c b/src/libultra/vimodes/vimodentschpf1.c similarity index 52% rename from src/libultra/io/osViModeNtscHpf1.c rename to src/libultra/vimodes/vimodentschpf1.c index 672a2a17f..ce7c7d8a7 100644 --- a/src/libultra/io/osViModeNtscHpf1.c +++ b/src/libultra/vimodes/vimodentschpf1.c @@ -1,19 +1,21 @@ -#include "global.h" +#include "PR/os.h" +#include "PR/rcp.h" #include "PR/viint.h" OSViMode osViModeNtscHpf1 = { OS_VI_NTSC_HPF1, // type { // comRegs - 0x324E, // ctrl - WIDTH(640), // width - BURST(57, 34, 5, 62), // 0x3E52239, // burst - VSYNC(524), // vSync - HSYNC(3093, 0), // hSync - LEAP(3093, 3093), // leap - HSTART(108, 748), // 0x6C02EC, // hStart - SCALE(1, 0), // xScale - VCURRENT(0), // vCurrent + VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | VI_CTRL_SERRATE_ON | VI_CTRL_ANTIALIAS_MODE_2 | + VI_CTRL_PIXEL_ADV_3, // ctrl + WIDTH(640), // width + BURST(57, 34, 5, 62), // 0x3E52239, // burst + VSYNC(524), // vSync + HSYNC(3093, 0), // hSync + LEAP(3093, 3093), // leap + HSTART(108, 748), // 0x6C02EC, // hStart + SCALE(1, 0), // xScale + VCURRENT(0), // vCurrent }, { // fldRegs { diff --git a/src/libultra/vimodes/vimodentschpn1.c b/src/libultra/vimodes/vimodentschpn1.c new file mode 100644 index 000000000..877da10c3 --- /dev/null +++ b/src/libultra/vimodes/vimodentschpn1.c @@ -0,0 +1,37 @@ +#include "PR/os.h" +#include "PR/rcp.h" +#include "PR/viint.h" + +OSViMode osViModeNtscHpn1 = { + OS_VI_NTSC_HPN1, // type + { + // comRegs + VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | VI_CTRL_SERRATE_ON | VI_CTRL_ANTIALIAS_MODE_2 | + VI_CTRL_PIXEL_ADV_3, // ctrl + WIDTH(1280), // width + BURST(57, 34, 5, 62), // burst + VSYNC(524), // vSync + HSYNC(3093, 0), // hSync + LEAP(3093, 3093), // leap + HSTART(108, 748), // hStart + SCALE(1, 0), // xScale + VCURRENT(0), // vCurrent + }, + { // fldRegs + { + // [0] + ORIGIN(1280), // origin + SCALE(1, 0), // yScale + HSTART(35, 509), // vStart + BURST(4, 2, 14, 0), // vBurst + VINTR(2), // vIntr + }, + { + // [1] + ORIGIN(2560), // origin + SCALE(1, 0), // yScale + HSTART(37, 511), // vStart + BURST(4, 2, 14, 0), // vBurst + VINTR(2), // vIntr + } }, +}; diff --git a/src/libultra/io/osViModeNtscLan1.c b/src/libultra/vimodes/vimodentsclan1.c similarity index 52% rename from src/libultra/io/osViModeNtscLan1.c rename to src/libultra/vimodes/vimodentsclan1.c index afbe46fab..76dd9135f 100644 --- a/src/libultra/io/osViModeNtscLan1.c +++ b/src/libultra/vimodes/vimodentsclan1.c @@ -1,19 +1,21 @@ -#include "global.h" +#include "PR/os.h" +#include "PR/rcp.h" #include "PR/viint.h" OSViMode osViModeNtscLan1 = { OS_VI_NTSC_LAN1, // type { // comRegs - 0x311E, // ctrl - WIDTH(320), // width - BURST(57, 34, 5, 62), // burst - VSYNC(525), // vSync - HSYNC(3093, 0), // hSync - LEAP(3093, 3093), // leap - HSTART(108, 748), // hStart - SCALE(2, 0), // xScale - VCURRENT(0), // vCurrent + VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | VI_CTRL_DIVOT_ON | VI_CTRL_ANTIALIAS_MODE_1 | + VI_CTRL_PIXEL_ADV_3, // ctrl + WIDTH(320), // width + BURST(57, 34, 5, 62), // burst + VSYNC(525), // vSync + HSYNC(3093, 0), // hSync + LEAP(3093, 3093), // leap + HSTART(108, 748), // hStart + SCALE(2, 0), // xScale + VCURRENT(0), // vCurrent }, { // fldRegs { diff --git a/src/libultra/io/osViModePalLan1.c b/src/libultra/vimodes/vimodepallan1.c similarity index 53% rename from src/libultra/io/osViModePalLan1.c rename to src/libultra/vimodes/vimodepallan1.c index 66ae4e6f1..933f9c00c 100644 --- a/src/libultra/io/osViModePalLan1.c +++ b/src/libultra/vimodes/vimodepallan1.c @@ -1,19 +1,21 @@ -#include "global.h" +#include "PR/os.h" +#include "PR/rcp.h" #include "PR/viint.h" OSViMode osViModePalLan1 = { OS_VI_PAL_LAN1, // type { // comRegs - 0x311E, // ctrl - WIDTH(320), // width - BURST(58, 30, 4, 69), // burst - VSYNC(625), // vSync - HSYNC(3177, 23), // hSync - LEAP(3183, 3181), // leap - HSTART(128, 768), // hStart - SCALE(2, 0), // xScale - VCURRENT(0), // vCurrent + VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | VI_CTRL_DIVOT_ON | VI_CTRL_ANTIALIAS_MODE_1 | + VI_CTRL_PIXEL_ADV_3, // ctrl + WIDTH(320), // width + BURST(58, 30, 4, 69), // burst + VSYNC(625), // vSync + HSYNC(3177, 23), // hSync + LEAP(3183, 3181), // leap + HSTART(128, 768), // hStart + SCALE(2, 0), // xScale + VCURRENT(0), // vCurrent }, { // fldRegs { diff --git a/src/libultra/voice/voicecontread2.c b/src/libultra/voice/voicecontread2.c index ba60a64c3..a9e6660bb 100644 --- a/src/libultra/voice/voicecontread2.c +++ b/src/libultra/voice/voicecontread2.c @@ -2,11 +2,11 @@ * File: voicecontread2.c */ +#include "ultra64.h" #include "PR/controller_voice.h" -#include "PR/voice_internal.h" +#include "PR/voiceinternal.h" #include "PR/controller.h" -#include "functions.h" -#include "variables.h" +#include "macros.h" #define READ2FORMAT(ptr) ((__OSVoiceRead2Format*)(ptr)) diff --git a/src/libultra/voice/voicecontread36.c b/src/libultra/voice/voicecontread36.c index 248360b00..eb4ead42e 100644 --- a/src/libultra/voice/voicecontread36.c +++ b/src/libultra/voice/voicecontread36.c @@ -2,11 +2,11 @@ * File: voicecontread36.c */ +#include "ultra64.h" #include "PR/controller_voice.h" -#include "PR/voice_internal.h" +#include "PR/voiceinternal.h" #include "PR/controller.h" -#include "functions.h" -#include "variables.h" +#include "macros.h" #define READ36FORMAT(ptr) ((__OSVoiceRead36Format*)(ptr)) diff --git a/src/libultra/voice/voicecontwrite20.c b/src/libultra/voice/voicecontwrite20.c index a346294bd..89d5e933c 100644 --- a/src/libultra/voice/voicecontwrite20.c +++ b/src/libultra/voice/voicecontwrite20.c @@ -2,11 +2,11 @@ * File: voicecontwrite20.c */ +#include "ultra64.h" #include "PR/controller_voice.h" -#include "PR/voice_internal.h" +#include "PR/voiceinternal.h" #include "PR/controller.h" -#include "functions.h" -#include "variables.h" +#include "macros.h" #define WRITE20FORMAT(ptr) ((__OSVoiceWrite20Format*)(ptr)) diff --git a/src/libultra/voice/voicecontwrite4.c b/src/libultra/voice/voicecontwrite4.c index e828fc4c6..b0c6a4e53 100644 --- a/src/libultra/voice/voicecontwrite4.c +++ b/src/libultra/voice/voicecontwrite4.c @@ -2,11 +2,11 @@ * File: voicecontwrite4.c */ +#include "ultra64.h" #include "PR/controller_voice.h" -#include "PR/voice_internal.h" +#include "PR/voiceinternal.h" #include "PR/controller.h" -#include "functions.h" -#include "variables.h" +#include "macros.h" #define WRITE4FORMAT(ptr) ((__OSVoiceWrite4Format*)(ptr)) diff --git a/src/libultra/voice/voicegetstatus.c b/src/libultra/voice/voicegetstatus.c index b19348908..2e5713f76 100644 --- a/src/libultra/voice/voicegetstatus.c +++ b/src/libultra/voice/voicegetstatus.c @@ -2,9 +2,9 @@ * File: voicegetstatus.c */ +#include "ultra64.h" #include "PR/controller_voice.h" #include "PR/controller.h" -#include "functions.h" s32 __osVoiceGetStatus(OSMesgQueue* mq, s32 channel, u8* status) { __OSContRequestHeaderAligned header; diff --git a/src/libultra/voice/voiceinit.c b/src/libultra/voice/voiceinit.c index f8c965f70..69fc2fd7c 100644 --- a/src/libultra/voice/voiceinit.c +++ b/src/libultra/voice/voiceinit.c @@ -4,10 +4,10 @@ * Initializes Voice Recognition System control structure and hardware */ +#include "ultra64.h" #include "PR/controller_voice.h" #include "PR/os_voice.h" #include "PR/controller.h" -#include "functions.h" #include "macros.h" static u8 sCmds[] = { diff --git a/src/libultra/voice/voicemaskdictionary.c b/src/libultra/voice/voicemaskdictionary.c index 225c45dee..6ff957d45 100644 --- a/src/libultra/voice/voicemaskdictionary.c +++ b/src/libultra/voice/voicemaskdictionary.c @@ -4,10 +4,10 @@ * Mask words registered in the voice recognition system */ +#include "ultra64.h" #include "PR/controller_voice.h" #include "PR/os_voice.h" #include "PR/controller.h" -#include "functions.h" #include "macros.h" s32 osVoiceMaskDictionary(OSVoiceHandle* hd, u8* maskPattern, int size) { diff --git a/src/libultra/voice/voicesetadconverter.c b/src/libultra/voice/voicesetadconverter.c index 1b3d87cd5..bb8e7e169 100644 --- a/src/libultra/voice/voicesetadconverter.c +++ b/src/libultra/voice/voicesetadconverter.c @@ -2,11 +2,10 @@ * File: voicesetadconverter.c */ +#include "ultra64.h" #include "PR/controller_voice.h" -#include "PR/voice_internal.h" +#include "PR/voiceinternal.h" #include "PR/controller.h" -#include "functions.h" -#include "variables.h" #define SWRITEFORMAT(ptr) ((__OSVoiceSWriteFormat*)(ptr)) diff --git a/src/libultra/voice/voicesetword.c b/src/libultra/voice/voicesetword.c index 82b0f88aa..f832b6010 100644 --- a/src/libultra/voice/voicesetword.c +++ b/src/libultra/voice/voicesetword.c @@ -4,10 +4,10 @@ * Registers words to the Voice Recognition System dictionary */ +#include "ultra64.h" #include "PR/controller_voice.h" #include "PR/os_voice.h" #include "PR/controller.h" -#include "functions.h" #include "macros.h" s32 osVoiceSetWord(OSVoiceHandle* hd, u8* word) { diff --git a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c index 8850d8852..f0b2e66ff 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c @@ -794,7 +794,7 @@ void func_80B819F0(Actor* thisx, PlayState* play) { if (CutsceneManager_IsNext(this->dyna.actor.csId)) { CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); if (this->dyna.actor.csId >= 0) { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_WAIT); } func_80B81A64(this); } else { diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index ebdaeff51..0ab213d0a 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -126,7 +126,7 @@ s32 func_80953DA8(BgIngate* this, PlayState* play) { Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); if (CHECK_EVENTINF(EVENTINF_35)) { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_WAIT); } else { SET_EVENTINF(EVENTINF_41); } @@ -149,7 +149,7 @@ void func_80953E38(PlayState* play) { void func_80953EA4(BgIngate* this, PlayState* play) { Player* player = GET_PLAYER(play); - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_58); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_58); player->unk_3A0.x = this->dyna.actor.world.pos.x; player->unk_3A0.z = this->dyna.actor.world.pos.z; this->unk160 &= ~0x4; @@ -192,7 +192,7 @@ void func_80953F9C(BgIngate* this, PlayState* play) { if (this->timePath->additionalPathIndex != ADDITIONAL_PATH_INDEX_NONE) { func_80953E38(play); - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_WAIT); this->dyna.actor.textId = 0x9E4; Message_StartTextbox(play, this->dyna.actor.textId, NULL); this->unk16C += 1; @@ -231,7 +231,7 @@ void func_809541B8(BgIngate* this, PlayState* play) { if ((player->transformation == PLAYER_FORM_HUMAN) && (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->dyna.actor.xzDistToPlayer < 40.0f)) { if (this->dyna.actor.playerHeightRel > 15.0f) { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_WAIT); this->dyna.actor.textId = 0x9E6; Message_StartTextbox(play, this->dyna.actor.textId, NULL); this->actionFunc = func_809543D4; @@ -261,7 +261,7 @@ void func_809542A0(BgIngate* this, PlayState* play) { void func_80954340(BgIngate* this, PlayState* play) { if (DECR(this->unk16A) == 0) { if (this->timePath != NULL) { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_END); this->timePath = &play->setupPathList[this->timePath->additionalPathIndex]; func_80953F14(this, play); Environment_StopTime(); @@ -280,7 +280,7 @@ void func_809543D4(BgIngate* this, PlayState* play) { break; case 0x9E5: if (play->msgCtx.choiceIndex == 0) { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_END); this->unk160 &= ~0x4; this->actionFunc = func_809541B8; Environment_StartTime(); @@ -301,7 +301,7 @@ void func_809543D4(BgIngate* this, PlayState* play) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40); Audio_PlaySfx_MessageDecide(); } else { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_END); this->unk160 &= ~0x4; this->actionFunc = func_809541B8; Environment_StartTime(); diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index f96c2864f..d5f85443e 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -2172,7 +2172,7 @@ void func_809DEAC4(Boss02* this, PlayState* play) { } if (this->unk_1D1C == 45) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_21); + func_800B7298(play, &this->actor, PLAYER_CSACTION_21); sMusicStartTimer = KREG(91) + 43; } @@ -2186,7 +2186,7 @@ void func_809DEAC4(Boss02* this, PlayState* play) { } if (this->unk_1D1C == 100) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_115); + func_800B7298(play, &this->actor, PLAYER_CSACTION_115); } if (this->unk_1D1C == 112) { @@ -2225,7 +2225,7 @@ void func_809DEAC4(Boss02* this, PlayState* play) { func_80169AFC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->actor, PLAYER_CSACTION_END); this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->unk_1D20 = 0; sRedTwinmold->unk_0144 = sBlueTwinmold->unk_0144 = 3; @@ -2286,7 +2286,7 @@ void func_809DEAC4(Boss02* this, PlayState* play) { func_80169AFC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->actor, PLAYER_CSACTION_END); this->unk_1D20 = 0; this->actor.flags |= ACTOR_FLAG_TARGETABLE; sp68->unk_0144 = 10; diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index 9e1111a6b..202e836a5 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -687,7 +687,7 @@ void Boss03_ChasePlayer(Boss03* this, PlayState* play) { if (&this->actor == player->actor.parent) { player->actionVar2 = 101; player->actor.parent = NULL; - player->csMode = PLAYER_CSMODE_NONE; + player->csAction = PLAYER_CSACTION_NONE; } func_809E344C(this, play); @@ -783,7 +783,7 @@ void Boss03_CatchPlayer(Boss03* this, PlayState* play) { if (&this->actor == player->actor.parent) { player->actionVar2 = 101; player->actor.parent = NULL; - player->csMode = PLAYER_CSMODE_NONE; + player->csAction = PLAYER_CSACTION_NONE; Play_DisableMotionBlur(); } @@ -911,7 +911,7 @@ void Boss03_ChewPlayer(Boss03* this, PlayState* play) { if (&this->actor == player->actor.parent) { player->actionVar2 = 101; player->actor.parent = NULL; - player->csMode = PLAYER_CSMODE_NONE; + player->csAction = PLAYER_CSACTION_NONE; Play_DisableMotionBlur(); func_800B8D50(play, NULL, 10.0f, this->actor.shape.rot.y, 0.0f, 0x20); } @@ -1149,7 +1149,7 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { case 0: if (player->actor.world.pos.y < 1350.0f) { Cutscene_StartManual(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); @@ -1260,7 +1260,7 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { if (this->csTimer == 5) { // Rotates Player towards Gyorg - func_800B7298(play, &this->actor, PLAYER_CSMODE_8); + func_800B7298(play, &this->actor, PLAYER_CSACTION_8); } this->subCamEye.x = player->actor.world.pos.x + 30.0f; @@ -1371,7 +1371,7 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { func_80169AFC(play, this->subCamId, 0); Cutscene_StopManual(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->actor, PLAYER_CSACTION_END); this->subCamId = SUB_CAM_ID_DONE; func_809E344C(this, play); @@ -1449,7 +1449,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { case 0: if (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) { Cutscene_StartManual(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_1); + func_800B7298(play, &this->actor, PLAYER_CSACTION_1); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); @@ -1628,7 +1628,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { func_80169AFC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->actor, PLAYER_CSACTION_END); this->csState = 3; Play_DisableMotionBlur(); Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_INIT_OLD); @@ -1662,7 +1662,7 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play) { case 0: if (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) { Cutscene_StartManual(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_1); + func_800B7298(play, &this->actor, PLAYER_CSACTION_1); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); @@ -1723,7 +1723,7 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play) { func_80169AFC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->actor, PLAYER_CSACTION_END); func_809E344C(this, play); this->workTimer[WORK_TIMER_UNK1_A] = 50; @@ -1753,7 +1753,7 @@ void Boss03_SetupStunned(Boss03* this, PlayState* play) { if (&this->actor == player->actor.parent) { player->actionVar2 = 101; player->actor.parent = NULL; - player->csMode = PLAYER_CSMODE_NONE; + player->csAction = PLAYER_CSACTION_NONE; Play_DisableMotionBlur(); } @@ -1905,7 +1905,7 @@ void Boss03_UpdateCollision(Boss03* this, PlayState* play) { if (&this->actor == player->actor.parent) { player->actionVar2 = 101; player->actor.parent = NULL; - player->csMode = PLAYER_CSMODE_NONE; + player->csAction = PLAYER_CSACTION_NONE; Play_DisableMotionBlur(); } @@ -2156,7 +2156,7 @@ void Boss03_SetObject(PlayState* play, s16 objectId) { OPEN_DISPS(play->state.gfxCtx); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment); gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment); diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index c35e6e9b1..73a0271ed 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -264,7 +264,7 @@ void func_809EC568(Boss04* this, PlayState* play) { this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); player->actor.world.pos.x = this->unk_6E8; player->actor.world.pos.z = this->unk_6F0 + 410.0f; player->actor.shape.rot.y = 0x7FFF; @@ -314,7 +314,7 @@ void func_809EC568(Boss04* this, PlayState* play) { if (this->unk_704 == 45) { this->unk_708 = 1; this->unk_704 = 0; - func_800B7298(play, &this->actor, PLAYER_CSMODE_21); + func_800B7298(play, &this->actor, PLAYER_CSACTION_21); this->actor.gravity = 0.0f; break; } @@ -391,7 +391,7 @@ void func_809EC568(Boss04* this, PlayState* play) { func_80169AFC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->actor, PLAYER_CSACTION_END); Play_DisableMotionBlur(); SET_EVENTINF(EVENTINF_60); } diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c index 6dc94e0e3..afce1ef95 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c @@ -147,7 +147,7 @@ void Boss06_Init(Actor* thisx, PlayState* play) { this->actor.shape.rot.y = -0x8000; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - temp_v0 = SEGMENTED_TO_VIRTUAL(&object_knight_Tex_019490); + temp_v0 = SEGMENTED_TO_K0(&object_knight_Tex_019490); for (i = 0; i < ARRAY_COUNT(this->unk_200); i++) { this->unk_200[i] = temp_v0[i]; } @@ -200,7 +200,7 @@ void func_809F24C8(Boss06* this, PlayState* play) { } Cutscene_StartManual(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); @@ -240,7 +240,7 @@ void func_809F24C8(Boss06* this, PlayState* play) { this->unk_1D8 = 0.0f; if (this->unk_1CA == 60) { D_809F4970->unk_154++; - func_800B7298(play, &this->actor, PLAYER_CSMODE_132); + func_800B7298(play, &this->actor, PLAYER_CSACTION_132); player->actor.shape.rot.y = 0; player->actor.world.rot.y = player->actor.shape.rot.y; } @@ -333,7 +333,7 @@ void func_809F24C8(Boss06* this, PlayState* play) { func_80169AFC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->actor, PLAYER_CSACTION_END); D_809F4970->unk_151 = 0; } break; @@ -530,7 +530,7 @@ void Boss06_Draw(Actor* thisx, PlayState* play2) { if (this->unk_144 & 2) { temp_s0 = Math_SinS(D_809F4970->unk_144) * 1000.0f; temp_f10 = (Math_CosS(D_809F4970->unk_144) * -2000.0f) - 2000.0f; - temp_v0_2 = SEGMENTED_TO_VIRTUAL(&object_knight_Vtx_018BD0); + temp_v0_2 = SEGMENTED_TO_K0(&object_knight_Vtx_018BD0); temp_v0_2[0].v.ob[1] = (s16)this->unk_1A0 + 0xE92; temp_v0_2[3].v.ob[1] = (s16)this->unk_1A0 + 0xE92; diff --git a/src/overlays/actors/ovl_Dm_An/z_dm_an.c b/src/overlays/actors/ovl_Dm_An/z_dm_an.c index 090360dd7..e67e9e6f5 100644 --- a/src/overlays/actors/ovl_Dm_An/z_dm_an.c +++ b/src/overlays/actors/ovl_Dm_An/z_dm_an.c @@ -92,9 +92,9 @@ s32 DmAn_UpdateSkelAnime(DmAn* this, PlayState* play) { } if (objectSlot2 > OBJECT_SLOT_NONE) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot2].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot2].segment); isAnimFinished = SkelAnime_Update(&this->skelAnime); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } return isAnimFinished; @@ -112,10 +112,10 @@ s32 DmAn_ChangeAnim(DmAn* this, PlayState* play, DmAnAnimation animIndex) { } if ((objectSlot2 > OBJECT_SLOT_NONE) && (this->animIndex != animIndex)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot2].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot2].segment); this->animIndex = animIndex; didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } return didAnimChange; diff --git a/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c b/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c index a0fa8d6b3..254a4ca90 100644 --- a/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c +++ b/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c @@ -222,7 +222,7 @@ void DmBal_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_K0(sEyeTextures[this->eyeIndex])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, DmBal_OverrideLimbDraw, DmBal_PostLimbDraw, &this->actor); diff --git a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c index 458b51193..4eb139998 100644 --- a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c +++ b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c @@ -92,9 +92,9 @@ s32 DmGm_UpdateSkelAnime(DmGm* this, PlayState* play) { } if (objectIndex2 > OBJECT_SLOT_NONE) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectIndex2].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectIndex2].segment); isAnimFinished = SkelAnime_Update(&this->skelAnime); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } return isAnimFinished; @@ -112,10 +112,10 @@ s32 DmGm_ChangeAnim(DmGm* this, PlayState* play, DmGmAnimation animIndex) { } if ((objectIndex2 > OBJECT_SLOT_NONE) && (this->animIndex != animIndex)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectIndex2].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectIndex2].segment); this->animIndex = animIndex; didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } return didAnimChange; diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index e4f85e15c..73bf18c1a 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -320,7 +320,7 @@ void DmStk_LoadObjectForAnimation(DmStk* this, PlayState* play) { } if (objectSlot > OBJECT_SLOT_NONE) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } } @@ -1968,13 +1968,13 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot (this->objectStk2ObjectSlot > OBJECT_SLOT_NONE)) { Matrix_Push(); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectStk2ObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectStk2ObjectSlot].segment); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectStk2ObjectSlot].segment); AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gSkullKidMajorasMaskCurseOverlayTexAnim)); Gfx_DrawDListOpa(play, gSkullKidMajorasMaskCurseOverlayDL); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectStkObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectStkObjectSlot].segment); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectStkObjectSlot].segment); @@ -2095,7 +2095,7 @@ void DmStk_Draw(Actor* thisx, PlayState* play) { return; } - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectStkObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectStkObjectSlot].segment); OPEN_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c b/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c index 4abce0d2f..4531f235a 100644 --- a/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c +++ b/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c @@ -154,7 +154,7 @@ s32 func_80C224D8(DmTag* this, PlayState* play) { break; case 6: - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); play->nextEntrance = ENTRANCE(STOCK_POT_INN, 5); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; @@ -171,7 +171,7 @@ s32 func_80C224D8(DmTag* this, PlayState* play) { s32 func_80C227E8(DmTag* this, PlayState* play) { if (this->unk_1A4 == 0) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); play->nextEntrance = ENTRANCE(STOCK_POT_INN, 4); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index b0805ef59..10c2f050a 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -462,7 +462,7 @@ s32 func_808A1478(DoorShutter* this, PlayState* play, f32 arg2) { } if ((this->csId != CS_ID_NONE) && (CutsceneManager_GetCurrentCsId() == this->csId)) { - func_800B724C(play, &this->slidingDoor.dyna.actor, PLAYER_CSMODE_1); + func_800B724C(play, &this->slidingDoor.dyna.actor, PLAYER_CSACTION_1); } } @@ -582,7 +582,7 @@ void func_808A1884(DoorShutter* this, PlayState* play) { if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_DOOR) { func_801226E0(play, ((void)0, gSaveContext.respawn[RESPAWN_MODE_DOWN].data)); player->csId = CS_ID_NONE; - func_800B7298(play, NULL, PLAYER_CSMODE_115); + func_800B7298(play, NULL, PLAYER_CSACTION_115); } } } @@ -636,8 +636,8 @@ void func_808A1B48(DoorShutter* this, PlayState* play) { void func_808A1C50(DoorShutter* this, PlayState* play) { if (this->unk_167++ > 30) { - if (GET_PLAYER(play)->csMode == PLAYER_CSMODE_115) { - func_800B7298(play, NULL, PLAYER_CSMODE_END); + if (GET_PLAYER(play)->csAction == PLAYER_CSACTION_115) { + func_800B7298(play, NULL, PLAYER_CSACTION_END); } DoorShutter_SetupDoor(this, play); } diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index ec1480a67..4d44941b3 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -344,7 +344,7 @@ void func_808B921C(DoorWarp1* this, PlayState* play) { } if (func_808B866C(this, play) && !Play_InCsMode(play)) { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_WAIT); Message_StartTextbox(play, 0xF2, &this->dyna.actor); DoorWarp1_SetupAction(this, func_808B93A0); } @@ -360,14 +360,14 @@ void func_808B93A0(DoorWarp1* this, PlayState* play) { Message_CloseTextbox(play); if (play->msgCtx.choiceIndex == 0) { Audio_PlaySfx_MessageDecide(); - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_9); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_9); player->unk_3A0.x = this->dyna.actor.world.pos.x; player->unk_3A0.z = this->dyna.actor.world.pos.z; this->unk_1CA = 1; DoorWarp1_SetupAction(this, func_808B9524); } else { Audio_PlaySfx_MessageCancel(); - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_END); DoorWarp1_SetupAction(this, func_808B94A4); } } @@ -448,7 +448,7 @@ void func_808B977C(DoorWarp1* this, PlayState* play) { AudioSfx_PlaySfx(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_9); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_9); player->unk_3A0.x = this->dyna.actor.world.pos.x; player->unk_3A0.z = this->dyna.actor.world.pos.z; this->unk_1CA = 1; @@ -602,7 +602,7 @@ void func_808B9F10(DoorWarp1* this, PlayState* play) { Player* player = GET_PLAYER(play); Interface_SetHudVisibility(HUD_VISIBILITY_NONE); - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_9); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_9); player->unk_3A0.x = this->dyna.actor.world.pos.x; player->unk_3A0.z = this->dyna.actor.world.pos.z; this->unk_1CA = 20; diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c index 783f157b1..58b2589c9 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c @@ -448,7 +448,7 @@ void EnAob01_BeforeRace_HandleConversation(EnAob01* this, PlayState* play) { if (this->stateFlags & ENAOB01_FLAG_PLAYER_CONFIRMED_CHOICE) { this->stateFlags &= ~ENAOB01_FLAG_PLAYER_CONFIRMED_CHOICE; Rupees_ChangeBy(-this->rupeesBet); - func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); + func_800B7298(play, NULL, PLAYER_CSACTION_WAIT); play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = EnAob01_BeforeRace_StartRace; diff --git a/src/overlays/actors/ovl_En_Bal/z_en_bal.c b/src/overlays/actors/ovl_En_Bal/z_en_bal.c index 95b495124..3bd63b1a6 100644 --- a/src/overlays/actors/ovl_En_Bal/z_en_bal.c +++ b/src/overlays/actors/ovl_En_Bal/z_en_bal.c @@ -1166,7 +1166,7 @@ void EnBal_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_K0(sEyeTextures[this->eyeTexIndex])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnBal_OverrideLimbDraw, EnBal_PostLimbDraw, &this->picto.actor); diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c index 850ffa198..54595f360 100644 --- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c +++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c @@ -265,8 +265,8 @@ s32 EnBba01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->enHy.headObjectSlot].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->enHy.headObjectSlot].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->enHy.skelLowerObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->enHy.headObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->enHy.skelLowerObjectSlot].segment); CLOSE_DISPS(play->state.gfxCtx); } @@ -304,7 +304,7 @@ void EnBba01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->enHy.skelUpperObjectSlot].segment); - gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->enHy.skelUpperObjectSlot].segment); + gSegments[0x06] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->enHy.skelUpperObjectSlot].segment); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 0f505820d..12a14af77 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -378,7 +378,7 @@ void EnBigokuta_PlayDeathCutscene(EnBigokuta* this, PlayState* play) { CutsceneManager_Start(this->csId, &this->picto.actor); if (!CHECK_EVENTINF(EVENTINF_41) && !CHECK_EVENTINF(EVENTINF_35)) { - func_800B724C(play, &this->picto.actor, PLAYER_CSMODE_WAIT); + func_800B724C(play, &this->picto.actor, PLAYER_CSACTION_WAIT); } else { player = GET_PLAYER(play); player->stateFlags1 |= PLAYER_STATE1_20; @@ -454,7 +454,7 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) { Actor_Kill(&this->picto.actor); if (!CHECK_EVENTINF(EVENTINF_41) && !CHECK_EVENTINF(EVENTINF_35)) { - func_800B724C(play, &this->picto.actor, PLAYER_CSMODE_END); + func_800B724C(play, &this->picto.actor, PLAYER_CSACTION_END); } else { Player* player = GET_PLAYER(play); diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index 4fa521de3..c4e1433e7 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -308,7 +308,7 @@ void EnBigpo_SetupSpawnCutscene(EnBigpo* this) { void EnBigpo_WaitCutsceneQueue(EnBigpo* this, PlayState* play) { if (CutsceneManager_IsNext(this->actor.csId)) { CutsceneManager_Start(this->actor.csId, &this->actor); - func_800B724C(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B724C(play, &this->actor, PLAYER_CSACTION_WAIT); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->actor.csId); if (this->actor.params == BIG_POE_TYPE_REGULAR) { // and SUMMONED, got switched earlier EnBigpo_SpawnCutsceneStage1(this, play); @@ -478,7 +478,7 @@ void EnBigpo_SpawnCutsceneStage8(EnBigpo* this, PlayState* play) { } else { // BIG_POE_TYPE_REGULAR CutsceneManager_Stop(this->actor.csId); } - func_800B724C(play, &this->actor, PLAYER_CSMODE_END); + func_800B724C(play, &this->actor, PLAYER_CSACTION_END); EnBigpo_SetupIdleFlying(this); // setup idle flying } } @@ -1164,7 +1164,7 @@ void EnBigpo_Update(Actor* thisx, PlayState* play) { } if (EnBigpo_ApplyDamage(this, play) == 0) { - if ((this->actor.isLockedOn) && (this->actionFunc != EnBigpo_WarpingOut) && + if (this->actor.isLockedOn && (this->actionFunc != EnBigpo_WarpingOut) && !(this->collider.base.acFlags & AC_HARD) && (this->actor.category == ACTORCAT_ENEMY)) { this->unk20C++; } else { diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index e8ce29da2..f9abf465c 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -850,7 +850,7 @@ void EnBigslime_EndCutscene(EnBigslime* this, PlayState* play) { this->subCamId = SUB_CAM_ID_DONE; CutsceneManager_Stop(this->csId); this->csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); - func_800B724C(play, &this->actor, PLAYER_CSMODE_END); + func_800B724C(play, &this->actor, PLAYER_CSACTION_END); } } @@ -939,7 +939,7 @@ void EnBigslime_SetupCutsceneStartBattle(EnBigslime* this, PlayState* play) { this->bigslimeCollider[0].base.acFlags &= ~AC_ON; Math_Vec3f_Copy(&subCam->at, &this->actor.focus.pos); - func_800B7298(play, &this->actor, PLAYER_CSMODE_4); + func_800B7298(play, &this->actor, PLAYER_CSACTION_4); player->actor.shape.rot.y = this->actor.yawTowardsPlayer + 0x8000; player->actor.world.pos.x = Math_SinS(this->actor.yawTowardsPlayer) * 347.0f + this->actor.world.pos.x; @@ -987,7 +987,7 @@ void EnBigslime_SetupCallMinislime(EnBigslime* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gGekkoCallAnim, 5.0f); EnBigslime_GekkoSfxOutsideBigslime(this, NA_SE_EN_FROG_GREET); this->callTimer = 0; - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); this->actionFunc = EnBigslime_CallMinislime; } @@ -1011,7 +1011,7 @@ void EnBigslime_CallMinislime(EnBigslime* this, PlayState* play) { EnBigslime_InitFallMinislime(this); play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; this->callTimer = 35; - func_800B7298(play, &this->actor, PLAYER_CSMODE_4); + func_800B7298(play, &this->actor, PLAYER_CSACTION_4); } } @@ -2546,7 +2546,7 @@ void EnBigslime_PlayCutscene(EnBigslime* this, PlayState* play) { } else if (CutsceneManager_IsNext(this->csId)) { CutsceneManager_Start(this->csId, &this->actor); if (this->actionFuncStored != EnBigslime_SquishFlat) { - func_800B724C(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B724C(play, &this->actor, PLAYER_CSACTION_WAIT); } this->subCamId = CutsceneManager_GetCurrentSubCamId(this->csId); diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 061081bc1..948ee526f 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -427,7 +427,7 @@ void func_809C5310(EnBomBowlMan* this, PlayState* play) { if (player->actor.world.pos.x < 1510.0f) { if (player->transformation != PLAYER_FORM_DEKU) { if (this->actor.xzDistToPlayer < this->unk_2C8) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); func_809C53A4(this); } } else { @@ -485,7 +485,7 @@ void func_809C5598(EnBomBowlMan* this, PlayState* play) { } else if (this->actor.textId == 0x734) { this->actor.textId = 0x715; } else if (this->actor.textId == 0x715) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->actor, PLAYER_CSACTION_END); EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_17, 1.0f); func_809C59A4(this, play); return; @@ -497,7 +497,7 @@ void func_809C5598(EnBomBowlMan* this, PlayState* play) { Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_LEARNED_SECRET_CODE); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_RECEIVED_BOMBERS_NOTEBOOK); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_BOMBERS); - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); this->actionFunc = func_809C5738; return; } diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 8157d09c6..447c8ddb6 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -425,9 +425,9 @@ void func_80868B74(EnBox* this, PlayState* play) { this->unk_1A0++; if ((this->csId1 != CS_ID_NONE) && (CutsceneManager_GetCurrentCsId() == this->csId1)) { if (this->unk_1A0 == 2) { - func_800B724C(play, &this->dyna.actor, PLAYER_CSMODE_4); + func_800B724C(play, &this->dyna.actor, PLAYER_CSACTION_4); } else if (this->unk_1A0 == 22) { - func_800B724C(play, &this->dyna.actor, PLAYER_CSMODE_1); + func_800B724C(play, &this->dyna.actor, PLAYER_CSACTION_1); } } } else if (this->unk_1A0 < 60) { diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 89e73c9a6..edae8b849 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -560,7 +560,7 @@ void EnClearTag_UpdateCamera(EnClearTag* this, PlayState* play) { this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); - func_800B7298(play, &this->actor, PLAYER_CSMODE_4); + func_800B7298(play, &this->actor, PLAYER_CSACTION_4); mainCam = Play_GetCamera(play, CAM_ID_MAIN); this->subCamEye.x = mainCam->eye.x; this->subCamEye.y = mainCam->eye.y; @@ -586,7 +586,7 @@ void EnClearTag_UpdateCamera(EnClearTag* this, PlayState* play) { mainCam->at = this->subCamAt; func_80169AFC(play, this->subCamId, 0); Cutscene_StopManual(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->actor, PLAYER_CSACTION_END); this->cameraState = 0; this->subCamId = SUB_CAM_ID_DONE; this->activeTimer = 20; diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c index c55169218..d2d2323c5 100644 --- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c +++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c @@ -255,9 +255,9 @@ s32 EnCne01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->enHy.headObjectSlot].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->enHy.headObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->enHy.headObjectSlot].segment); *dList = gCneHeadBrownHairDL; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->enHy.skelLowerObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->enHy.skelLowerObjectSlot].segment); CLOSE_DISPS(play->state.gfxCtx); } @@ -295,7 +295,7 @@ void EnCne01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->enHy.skelUpperObjectSlot].segment); - gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->enHy.skelUpperObjectSlot].segment); + gSegments[0x06] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->enHy.skelUpperObjectSlot].segment); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index 22c247c1f..c7bb3c44c 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -369,7 +369,7 @@ void func_8089ABF4(EnDinofos* this, PlayState* play) { this->subCamId = SUB_CAM_ID_DONE; CutsceneManager_Stop(this->actor.csId); if (this->actor.colChkInfo.health == 0) { - func_800B724C(play, &this->actor, PLAYER_CSMODE_END); + func_800B724C(play, &this->actor, PLAYER_CSACTION_END); } } } @@ -1209,7 +1209,7 @@ void func_8089D318(EnDinofos* this, PlayState* play) { if (CutsceneManager_IsNext(this->actor.csId)) { if (this->actor.colChkInfo.health == 0) { CutsceneManager_Start(this->actor.csId, &this->actor); - func_800B724C(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B724C(play, &this->actor, PLAYER_CSACTION_WAIT); } else { CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c b/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c index e30ee26ab..c2b6f508f 100644 --- a/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c +++ b/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c @@ -71,7 +71,7 @@ static TexturePtr sEyeTextures[] = { }; s32 func_80A50D40(Actor* actor, PlayState* play) { - func_800B7298(play, actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, actor, PLAYER_CSACTION_WAIT); if (CHECK_EVENTINF(EVENTINF_35)) { play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_CLEARED, 6); } else { diff --git a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c index 0dab8ff45..3f8318a37 100644 --- a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c +++ b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c @@ -210,7 +210,7 @@ s32 func_80A515C4(EnDnk* this) { void func_80A51648(EnDnk* this, PlayState* play) { if (SubS_IsObjectLoaded(this->objectSlot, play) == true) { - gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); + gSegments[0x06] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); this->actor.draw = func_80A52018; this->actor.objectSlot = this->objectSlot; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 18.0f); diff --git a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c index 59d504705..d87ac9f9e 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c @@ -542,7 +542,7 @@ void EnDragon_Grab(EnDragon* this, PlayState* play) { if (this->grabTimer > sMaxGrabTimerPerPython[this->pythonIndex]) { if (this->state == DEEP_PYTHON_GRAB_STATE_START) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->actor, PLAYER_CSACTION_END); this->state = DEEP_PYTHON_GRAB_STATE_GRABBED; } diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c index 645ad7300..f8c10408c 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -1120,7 +1120,7 @@ void func_80B2ADB0(EnFish2* this, Vec3f* vec, s16 arg2) { phi_v0 = gEffBubble1Tex; } - ptr->unk_20 = VIRTUAL_TO_PHYSICAL(SEGMENTED_TO_VIRTUAL(phi_v0)); + ptr->unk_20 = OS_K0_TO_PHYSICAL(SEGMENTED_TO_K0(phi_v0)); ptr->unk_00 = true; ptr->unk_04 = *vec; ptr->unk_04.x += Rand_CenteredFloat(ptr->unk_00 + (this->unk_330 * 4000.0f)); diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 9e442b637..4d2fc4db8 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -4,7 +4,6 @@ * Description: Fishing Pond Elements (Owner, Fish, Props, Effects...) */ -#include "prevent_bss_reordering.h" #include "z_en_fishing.h" #include "z64rumble.h" #include "z64shrink_window.h" @@ -5325,7 +5324,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { sSubCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, sSubCamId, CAM_STATUS_ACTIVE); - func_800B7298(play, &this->actor, PLAYER_CSMODE_4); + func_800B7298(play, &this->actor, PLAYER_CSACTION_4); mainCam = Play_GetCamera(play, CAM_ID_MAIN); sSubCamEye.x = mainCam->eye.x; @@ -5352,7 +5351,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { func_80169AFC(play, sSubCamId, 0); Cutscene_StopManual(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->actor, PLAYER_CSACTION_END); D_8090CD4C = 0; sSubCamId = SUB_CAM_ID_DONE; D_8090CD50 = 30; @@ -5366,7 +5365,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { sSubCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, sSubCamId, CAM_STATUS_ACTIVE); - func_800B7298(play, &this->actor, PLAYER_CSMODE_4); + func_800B7298(play, &this->actor, PLAYER_CSACTION_4); mainCam = Play_GetCamera(play, CAM_ID_MAIN); sSubCamEye.x = mainCam->eye.x; @@ -5453,7 +5452,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { mainCam->at = sSubCamAt; func_80169AFC(play, sSubCamId, 0); Cutscene_StopManual(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->actor, PLAYER_CSACTION_END); D_8090CD4C = 0; sSubCamId = SUB_CAM_ID_DONE; player->unk_B28 = -5; diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c index e7d8e9032..5e459fcbc 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -445,7 +445,7 @@ void func_80B0FFA8(EnGb2* this, PlayState* play) { Rupees_ChangeBy(-this->unk_288); play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; - func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); + func_800B7298(play, NULL, PLAYER_CSACTION_WAIT); this->actionFunc = func_80B11344; break; @@ -600,7 +600,7 @@ void func_80B10634(EnGb2* this, PlayState* play) { Rupees_ChangeBy(-this->unk_288); play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; - func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); + func_800B7298(play, NULL, PLAYER_CSACTION_WAIT); this->actionFunc = func_80B11344; } break; diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index 45d304aaf..eb9f21f55 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -479,7 +479,7 @@ void EnGe2_PatrolDuties(EnGe2* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 visionRange = gSaveContext.save.isNight ? 200.0f : 280.0f; - if (player->csMode == PLAYER_CSMODE_26) { + if (player->csAction == PLAYER_CSACTION_26) { this->picto.actor.speed = 0.0f; this->actionFunc = EnGe2_SetupCharge; Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, @@ -494,7 +494,7 @@ void EnGe2_PatrolDuties(EnGe2* this, PlayState* play) { this->picto.actor.shape.rot.y, 0x1800, visionRange, this->verticalDetectRange)) { if ((GERUDO_PURPLE_GET_EXIT(&this->picto.actor) != GERUDO_PURPLE_EXIT_NONE) && !Play_InCsMode(play)) { this->picto.actor.speed = 0.0f; - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_26); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_26); Lib_PlaySfx(NA_SE_SY_FOUND); Message_StartTextbox(play, 0x1194, &this->picto.actor); this->actionFunc = EnGe2_SetupCharge; @@ -682,7 +682,7 @@ void EnGe2_GuardStationary(EnGe2* this, PlayState* play) { if (EnGe2_LookForPlayer(play, &this->picto.actor, &this->picto.actor.focus.pos, this->picto.actor.shape.rot.y, 0x4000, 720.0f, this->verticalDetectRange)) { if ((GERUDO_PURPLE_GET_EXIT(&this->picto.actor) != GERUDO_PURPLE_EXIT_NONE) && !Play_InCsMode(play)) { - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_26); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_26); Lib_PlaySfx(NA_SE_SY_FOUND); Message_StartTextbox(play, 0x1194, &this->picto.actor); this->timer = 50; @@ -772,7 +772,7 @@ void EnGe2_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL37_Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_K0(sEyeTextures[this->eyeIndex])); func_800B8050(&this->picto.actor, play, 0); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGe2_OverrideLimbDraw, EnGe2_PostLimbDraw, &this->picto.actor); diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index 21f207e7c..71ac20e76 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -273,7 +273,7 @@ void EnGe3_AveilsChamberIdle(EnGe3* this, PlayState* play) { } } else if ((this->picto.actor.xzDistToPlayer < 700.0f) && (fabsf(this->picto.actor.playerHeightRel) < 100.0f) && !Play_InCsMode(play)) { - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_26); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_26); Lib_PlaySfx(NA_SE_SY_FOUND); if (Player_GetMask(play) == PLAYER_MASK_STONE) { // Not fooled by Stone Mask diff --git a/src/overlays/actors/ovl_En_Geg/z_en_geg.c b/src/overlays/actors/ovl_En_Geg/z_en_geg.c index 10c8b5037..ea78222e4 100644 --- a/src/overlays/actors/ovl_En_Geg/z_en_geg.c +++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.c @@ -416,12 +416,12 @@ s32 func_80BB1D64(EnGeg* this, PlayState* play) { } void EnGeg_UpdateSkelAnime(EnGeg* this, PlayState* play) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); SkelAnime_Update(&this->skelAnime); } void EnGeg_ChangeAnim(EnGeg* this, PlayState* play) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 47cddc9dd..b03909337 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -992,10 +992,10 @@ s32 EnGo_UpdateSkelAnime(EnGo* this, PlayState* play) { } if (extraObjIndex >= 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[extraObjIndex].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[extraObjIndex].segment); this->skelAnime.playSpeed = this->animPlaySpeed; isAnimFinished = SkelAnime_Update(&this->skelAnime); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } return isAnimFinished; @@ -1052,11 +1052,11 @@ s32 EnGo_ChangeAnim(EnGo* this, PlayState* play, EnGoAnimation animIndex) { } if (extraObjIndex >= 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[extraObjIndex].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[extraObjIndex].segment); this->animIndex = animIndex; didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); this->animPlaySpeed = this->skelAnime.playSpeed; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } return didAnimChange; diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 17f8cbb1d..4c815dc1e 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -389,7 +389,7 @@ void func_809984F4(EnGs* this, PlayState* play) { } } while (gossipStone != NULL); - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); this->actionFunc = func_809985B8; } diff --git a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c index b3ae6bbeb..7c5a3319e 100644 --- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c +++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c @@ -250,7 +250,7 @@ void func_80BC7068(EnGuruguru* this, PlayState* play) { } if (this->textIdIndex == 12) { SET_WEEKEVENTREG(WEEKEVENTREG_38_40); - func_801A3B48(0); + Audio_MuteSeqPlayerBgmSub(false); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_RECEIVED_BREMEN_MASK); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_GURU_GURU); func_80BC6E10(this); @@ -275,15 +275,15 @@ void func_80BC7068(EnGuruguru* this, PlayState* play) { if ((this->unk268 != 0) && (this->textIdIndex >= 7)) { this->skelAnime.playSpeed = 2.0f; Audio_SetSeqTempoAndFreq(3, 1.18921f, 2); - func_801A3B48(0); + Audio_MuteSeqPlayerBgmSub(false); } else { if (this->skelAnime.playSpeed == 2.0f) { Audio_SetSeqTempoAndFreq(3, 1.0f, 2); } if (this->unk268 == 0) { - func_801A3B48(1); + Audio_MuteSeqPlayerBgmSub(true); } else { - func_801A3B48(0); + Audio_MuteSeqPlayerBgmSub(false); } this->skelAnime.playSpeed = 1.0f; } @@ -291,14 +291,14 @@ void func_80BC7068(EnGuruguru* this, PlayState* play) { Message_ContinueTextbox(play, textIDs[this->textIdIndex]); return; } - func_801A3B48(0); + Audio_MuteSeqPlayerBgmSub(false); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_GURU_GURU); func_80BC6E10(this); } } void func_80BC73F4(EnGuruguru* this) { - func_801A3B48(0); + Audio_MuteSeqPlayerBgmSub(false); this->unk268 = 1; this->headZRotTarget = 0; this->unk272 = 2; @@ -311,7 +311,7 @@ void func_80BC7440(EnGuruguru* this, PlayState* play) { this->actor.parent = NULL; this->textIdIndex++; this->actor.textId = textIDs[this->textIdIndex]; - func_801A3B48(1); + Audio_MuteSeqPlayerBgmSub(true); Actor_OfferTalkExchange(&this->actor, play, 400.0f, 400.0f, PLAYER_IA_MINUS1); this->unk268 = 0; SET_WEEKEVENTREG(WEEKEVENTREG_38_40); @@ -405,8 +405,8 @@ void EnGuruguru_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); Gfx_SetupDL25_Xlu(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->texIndex])); - gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->texIndex])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_K0(sEyeTextures[this->texIndex])); + gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_K0(sMouthTextures[this->texIndex])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGuruguru_OverrideLimbDraw, NULL, &this->actor); diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index eaf49d673..59f085ec4 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -692,7 +692,7 @@ s32 EnHorse_PlayerCanMove(EnHorse* this, PlayState* play) { (((this->stateFlags & ENHORSE_FLAG_19) || (this->stateFlags & ENHORSE_FLAG_29)) && !this->inRace) || (this->action == ENHORSE_ACTION_HBA) || (player->actor.flags & ACTOR_FLAG_TALK_REQUESTED) || (play->csCtx.state != CS_STATE_IDLE) || (CutsceneManager_GetCurrentCsId() != CS_ID_NONE) || - (player->stateFlags1 & PLAYER_STATE1_20) || (player->csMode != PLAYER_CSMODE_NONE)) { + (player->stateFlags1 & PLAYER_STATE1_20) || (player->csAction != PLAYER_CSACTION_NONE)) { return false; } return true; diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/src/overlays/actors/ovl_En_Hs/z_en_hs.c index ef991495a..983cf2bdf 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -225,7 +225,7 @@ void EnHs_SceneTransitToBunnyHoodDialogue(EnHs* this, PlayState* play) { void func_80953354(EnHs* this, PlayState* play) { if (!Play_InCsMode(play)) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); this->actionFunc = EnHs_SceneTransitToBunnyHoodDialogue; } } diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index 4573bdcf5..e3f657ece 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -355,7 +355,7 @@ void EnJg_GoronShrineIdle(EnJg* this, PlayState* play) { this->flags |= FLAG_LOOKING_AT_PLAYER; Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnJg_GoronShrineTalk; - } else if ((this->actor.xzDistToPlayer < 100.0f) || (this->actor.isLockedOn)) { + } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isLockedOn) { Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); this->textId = EnJg_GetStartingConversationTextId(this, play); } @@ -919,7 +919,7 @@ void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnJg_SetupTalk; } else { - if ((this->actor.xzDistToPlayer < 100.0f) || (this->actor.isLockedOn)) { + if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isLockedOn) { Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); if (this->action == EN_JG_ACTION_FIRST_THAW) { this->textId = EnJg_GetStartingConversationTextId(this, play); diff --git a/src/overlays/actors/ovl_En_Jso/z_en_jso.c b/src/overlays/actors/ovl_En_Jso/z_en_jso.c index 5d083246a..1354a0a1c 100644 --- a/src/overlays/actors/ovl_En_Jso/z_en_jso.c +++ b/src/overlays/actors/ovl_En_Jso/z_en_jso.c @@ -367,7 +367,7 @@ void EnJso_HandleIntroCutscene(EnJso* this, PlayState* play) { } CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); - func_800B7298(play, &this->actor, PLAYER_CSMODE_21); + func_800B7298(play, &this->actor, PLAYER_CSACTION_21); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->actor.csId); player->actor.world.pos.x = this->actor.home.pos.x + 30.0f; player->actor.world.pos.z = this->actor.home.pos.z + 30.0f; @@ -472,7 +472,7 @@ void EnJso_HandleIntroCutscene(EnJso* this, PlayState* play) { } if (showTextbox) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_4); + func_800B7298(play, &this->actor, PLAYER_CSACTION_4); Message_StartTextbox(play, sTextIds[this->textIndex], &this->actor); this->textIndex++; this->actor.shape.yOffset = 970.0f; @@ -573,7 +573,7 @@ void EnJso_HandleIntroCutscene(EnJso* this, PlayState* play) { this->introCsTimer++; if (this->introCsTimer >= 10) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->actor, PLAYER_CSACTION_END); CutsceneManager_Stop(this->csId); this->rightArmRot.x = this->rightArmRot.y = this->rightArmRot.z = this->robeRightRot.x = this->robeRightRot.y = this->robeRightRot.z = 0; diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 59ba5feb4..b7310c1d3 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -481,7 +481,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { } CutsceneManager_StartWithPlayerCs(this->csId, &this->picto.actor); - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_21); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_21); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; @@ -538,7 +538,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { this->unk_2D8 = 0; this->picto.actor.world.pos.y = this->picto.actor.floorHeight; this->picto.actor.velocity.y = 0.0f; - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_4); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_4); Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, 0); Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, 0); Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_ONGND); @@ -609,7 +609,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { case 7: if (this->unk_598 == 0) { - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_END); CutsceneManager_Stop(this->csId); this->unk_59C = 0; this->subCamId = SUB_CAM_ID_DONE; @@ -674,7 +674,7 @@ void func_80B86804(EnKaizoku* this, PlayState* play) { CutsceneManager_StartWithPlayerCs(this->csId, &this->picto.actor); } - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_96); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_96); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); this->unk_2B2 = 30; this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; @@ -724,7 +724,7 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { case 2: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_END); CutsceneManager_Stop(this->csId); this->subCamId = SUB_CAM_ID_DONE; play->nextEntrance = play->setupExitList[this->exitIndex]; @@ -799,7 +799,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_18); - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_133); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_133); this->unk_5A0 = 0; this->unk_598 = 0; this->unk_59C++; @@ -865,7 +865,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { play->envCtx.fillScreen = false; this->unk_59C = 0; this->subCamId = SUB_CAM_ID_DONE; - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_END); CutsceneManager_Stop(this->csId); if (this->switchFlag > SWITCH_FLAG_NONE) { Flags_SetSwitch(play, this->switchFlag); @@ -1681,7 +1681,7 @@ void func_80B8960C(EnKaizoku* this, PlayState* play) { } this->picto.actor.speed = 0.0f; this->unk_2D8 = 1; - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_123); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_123); Enemy_StartFinishingBlow(play, &this->picto.actor); Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DEAD); this->picto.actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; @@ -2142,7 +2142,7 @@ void EnKaizoku_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_K0(sEyeTextures[this->eyeIndex])); SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnKaizoku_OverrideLimbDraw, EnKaizoku_PostLimbDraw, EnKaizoku_TransformLimbDraw, &this->picto.actor); diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index a3d0e4608..8f4fe160b 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -425,7 +425,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { } if ((this->unkState1A8 == 2) && (this->unkState196 == 2)) { - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_73); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_73); this->unkState1A8 = 0; } @@ -434,7 +434,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { if (this->talkState == TEXT_STATE_5) { // bad song input if ((this->unkState196 == 2) && (this->picto.actor.textId == 0x1647)) { - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_END); } // after timeskip @@ -461,7 +461,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { } else if ((this->picto.actor.textId == 0x165D) || (this->picto.actor.textId == 0x165F) || (this->picto.actor.textId == 0x1660) || (this->picto.actor.textId == 0x1652)) { - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_4); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_4); if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { CutsceneManager_Stop(CS_ID_GLOBAL_TALK); CutsceneManager_Queue(this->csIdList[0]); @@ -690,7 +690,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { if (this->unk190 == 0) { Message_CloseTextbox(play); - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_86); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_86); this->picto.actor.textId = 0x1648; Message_StartTextbox(play, (this->picto.actor.textId), &this->picto.actor); this->unkState1A8 = 0; @@ -726,7 +726,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos); CutsceneManager_StartWithPlayerCs(this->csIdList[0], &this->picto.actor); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_86); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_86); this->unkState1A8 = 1; } @@ -759,7 +759,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { } if (this->picto.actor.textId == 0x1648) { - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_WAIT); this->picto.actor.textId = 0x1649; if (this->animIndex != ENKAKASI_ANIM_ARMS_CROSSED_ROCKING) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); @@ -936,7 +936,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { this->unk190++; this->unk204 = 0xA; if (this->unk190 == 0xE) { - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_73); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_73); Play_DisableMotionBlur(); this->unk204 = 0x14; } @@ -1036,7 +1036,7 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { Math_ApproachF(&this->picto.actor.shape.yOffset, -6000.0f, 0.5f, 200.0f); if (fabsf(this->picto.actor.shape.yOffset + 6000.0f) < 10.0f) { SET_WEEKEVENTREG(WEEKEVENTREG_79_08); - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_END); CutsceneManager_Stop(this->csIdList[0]); this->aboveGroundStatus = ENKAKASI_ABOVE_GROUND_TYPE; this->songSummonDist = 80.0f; diff --git a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c index 09358e034..30f705aa7 100644 --- a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c +++ b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c @@ -359,7 +359,7 @@ void EnLookNuts_Update(Actor* thisx, PlayState* play) { Math_Vec3f_Copy(&this->headRotTarget, &gZeroVec3f); this->state = PALACE_GUARD_RUNNING_TO_PLAYER; Audio_PlaySfx(NA_SE_SY_FOUND); - func_800B7298(play, &this->actor, PLAYER_CSMODE_26); + func_800B7298(play, &this->actor, PLAYER_CSACTION_26); D_80A6862C = 1; this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_10); this->actor.gravity = 0.0f; diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 516112d3d..669621570 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -1083,8 +1083,8 @@ void EnMa4_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); - gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthTexIndex])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_K0(sEyeTextures[this->eyeTexIndex])); + gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_K0(sMouthTextures[this->mouthTexIndex])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMa4_OverrideLimbDraw, EnMa4_PostLimbDraw, &this->actor); diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c index 72fcc61d6..5e73bc43a 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c @@ -1081,7 +1081,7 @@ void EnMaYto_SetupPostMilkRunWaitDialogueEnd(EnMaYto* this) { void EnMaYto_PostMilkRunWaitDialogueEnd(EnMaYto* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) || (Message_GetState(&play->msgCtx) == TEXT_STATE_5)) { if (Message_ShouldAdvance(play) && (Message_GetState(&play->msgCtx) == TEXT_STATE_5)) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); Message_CloseTextbox(play); } } diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c index 651f8115f..41a764f1c 100644 --- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c +++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c @@ -551,8 +551,8 @@ void EnMaYts_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthTexIndex])); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); + gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_K0(sMouthTextures[this->mouthTexIndex])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_K0(sEyeTextures[this->eyeTexIndex])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMaYts_OverrideLimbDraw, EnMaYts_PostLimbDraw, &this->actor); diff --git a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c index a6d8eb8bb..e83911b46 100644 --- a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c +++ b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c @@ -266,9 +266,9 @@ void func_80A4E2E8(EnMkk* this, PlayState* play) { } else { sp20 = Math_StepToF(&this->actor.speed, 0.0f, 0.7f); } - if ((player->stateFlags3 & 0x100) || (Player_GetMask(play) == PLAYER_MASK_STONE)) { + if ((player->stateFlags3 & PLAYER_STATE3_100) || (Player_GetMask(play) == PLAYER_MASK_STONE)) { Math_ScaledStepToS(&this->unk_150, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 0x400); - } else if ((player->stateFlags2 & 0x80) || (player->actor.freezeTimer > 0)) { + } else if ((player->stateFlags2 & PLAYER_STATE2_80) || (player->actor.freezeTimer > 0)) { Math_ScaledStepToS(&this->unk_150, this->actor.yawTowardsPlayer + 0x8000, 0x400); } else { Math_ScaledStepToS(&this->unk_150, this->actor.yawTowardsPlayer, 0x400); @@ -279,7 +279,7 @@ void func_80A4E2E8(EnMkk* this, PlayState* play) { if (sp20) { this->unk_14B &= ~2; func_80A4E190(this); - } else if ((this->unk_149 == 0) && (!(player->stateFlags3 & 0x100)) && + } else if ((this->unk_149 == 0) && (!(player->stateFlags3 & PLAYER_STATE3_100)) && (Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (Actor_IsFacingPlayer(&this->actor, 0x1800)) && (this->actor.xzDistToPlayer < 120.0f) && (fabsf(this->actor.playerHeightRel) < 100.0f)) { diff --git a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c index 1a2925f65..cc75d7503 100644 --- a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c +++ b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c @@ -1620,7 +1620,7 @@ void EnMnk_MonkeyHanging_WaitForTextboxAfterDunk(EnMnk* this, PlayState* play) { } Message_CloseTextbox(play); this->actionFunc = EnMnk_MonkeyHanging_WaitAfterDunk; - func_800B7298(play, NULL, PLAYER_CSMODE_END); + func_800B7298(play, NULL, PLAYER_CSACTION_END); CLEAR_WEEKEVENTREG(WEEKEVENTREG_83_08); } } @@ -1693,7 +1693,7 @@ void EnMnk_MonkeyHanging_Plead(EnMnk* this, PlayState* play) { case 0x8E9: this->actionFunc = EnMnk_MonkeyHanging_Dunk2; Message_CloseTextbox(play); - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->picto.actor, PLAYER_CSACTION_WAIT); this->unk_3C8 = 60; break; diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c index 016f779e9..fbee0e80e 100644 --- a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c +++ b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c @@ -256,7 +256,7 @@ s32 EnMttag_ExitRace(PlayState* play, s32 transitionType, s32 nextTransitionType void EnMttag_ShowFalseStartMessage(EnMttag* this, PlayState* play) { gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF; Message_StartTextbox(play, 0xE95, NULL); // An entrant made a false start - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); this->actionFunc = EnMttag_PotentiallyRestartRace; } @@ -267,7 +267,7 @@ void EnMttag_ShowFalseStartMessage(EnMttag* this, PlayState* play) { */ void EnMttag_ShowCantWinMessage(EnMttag* this, PlayState* play) { Message_StartTextbox(play, 0xE97, NULL); // You can't win now... - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); this->actionFunc = EnMttag_HandleCantWinChoice; } @@ -433,7 +433,7 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) { play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; Message_CloseTextbox(play); - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); Magic_Add(play, MAGIC_FILL_TO_CAPACITY); CLEAR_EVENTINF(EVENTINF_10); @@ -468,7 +468,7 @@ void EnMttag_HandleCantWinChoice(EnMttag* this, PlayState* play) { // Keep racing Audio_PlaySfx_MessageDecide(); Message_CloseTextbox(play); - func_800B7298(play, &this->actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->actor, PLAYER_CSACTION_END); CLEAR_EVENTINF(EVENTINF_13); this->timer = 100; this->actionFunc = EnMttag_Race; diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index 83a8be394..d151f6aff 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -248,14 +248,14 @@ void EnNwc_CheckFound(EnNwc* this, PlayState* play) { void EnNwc_LoadNiwSkeleton(EnNwc* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->niwObjectSlot)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->niwObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->niwObjectSlot].segment); SkelAnime_InitFlex(play, &this->niwSkeleton, &gNiwSkel, &gNiwIdleAnim, this->jointTable, this->morphTable, NIW_LIMB_MAX); Animation_Change(&this->niwSkeleton, &gNiwIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gNiwIdleAnim), ANIMMODE_LOOP, 0.0f); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->nwcObjectIndex].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->nwcObjectIndex].segment); this->state = NWC_STATE_NIW_LOADED; EnNwc_ToggleState(this); } diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c index 4aca4b9bc..fc4dc720b 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c @@ -556,9 +556,9 @@ void EnPamera_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80BDA604[this->unk_312])); - gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(D_80BDA610[this->unk_314])); - gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(D_80BDA5FC[this->unk_310])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_K0(D_80BDA604[this->unk_312])); + gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_K0(D_80BDA610[this->unk_314])); + gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_K0(D_80BDA5FC[this->unk_310])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnPamera_OverrideLimbDraw, EnPamera_PostLimbDraw, &this->actor); diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index 37c234538..f774b07bf 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -343,7 +343,7 @@ void EnPametfrog_StopCutscene(EnPametfrog* this, PlayState* play) { Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; CutsceneManager_Stop(this->csId); - func_800B724C(play, &this->actor, PLAYER_CSMODE_END); + func_800B724C(play, &this->actor, PLAYER_CSACTION_END); } } @@ -1007,7 +1007,7 @@ void EnPametfrog_PlayCutscene(EnPametfrog* this, PlayState* play) { if (CutsceneManager_IsNext(this->csId)) { CutsceneManager_Start(this->csId, &this->actor); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->csId); - func_800B724C(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B724C(play, &this->actor, PLAYER_CSACTION_WAIT); if (this->actor.colChkInfo.health == 0) { if (this->actor.params == GEKKO_PRE_SNAPPER) { EnPametfrog_SetupCallSnapper(this, play); diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index 276ff8db7..e1c41ab1b 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -736,9 +736,10 @@ void EnRd_WalkToHome(EnRd* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; SkelAnime_Update(&this->skelAnime); - if (!(player->stateFlags1 & (0x200000 | 0x80000 | 0x40000 | 0x4000 | 0x2000 | 0x80)) && - !(player->stateFlags2 & (0x4000 | 0x80)) && (player->transformation != PLAYER_FORM_GORON) && - (player->transformation != PLAYER_FORM_DEKU) && + if (!(player->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_40000 | + PLAYER_STATE1_80000 | PLAYER_STATE1_200000)) && + !(player->stateFlags2 & (PLAYER_STATE2_80 | PLAYER_STATE2_4000)) && + (player->transformation != PLAYER_FORM_GORON) && (player->transformation != PLAYER_FORM_DEKU) && (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) < 150.0f)) { this->actor.targetMode = TARGET_MODE_0; EnRd_SetupWalkToPlayer(this, play); diff --git a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c index cd2b36634..9c2aad8af 100644 --- a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c +++ b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c @@ -788,7 +788,7 @@ s32 EnSGoro_UpdateCheerAnimation(EnSGoro* this, PlayState* play) { if (((EnJg*)this->otherGoron)->flags & 1) { this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_TAISOU); if (this->objectSlot > OBJECT_SLOT_NONE) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); this->animInfoIndex = EN_S_GORO_ANIM_TAISOU_CHEER; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); return true; @@ -797,7 +797,7 @@ s32 EnSGoro_UpdateCheerAnimation(EnSGoro* this, PlayState* play) { } else if ((this->animInfoIndex == EN_S_GORO_ANIM_TAISOU_CHEER) && !(((EnJg*)this->otherGoron)->flags & 1)) { this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_OF1D_MAP); if (this->objectSlot > OBJECT_SLOT_NONE) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); this->animInfoIndex = EN_S_GORO_ANIM_IDLE_STAND; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); this->skelAnime.curFrame = this->skelAnime.endFrame; @@ -1144,7 +1144,7 @@ void EnSGoro_SpringShrineGoron_Idle(EnSGoro* this, PlayState* play) { this->textId = EnSGoro_ShrineGoron_NextTextId(this, play); Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnSGoro_SpringShrineGoron_Talk; - } else if ((this->actor.xzDistToPlayer < 250.0f) || (this->actor.isLockedOn)) { + } else if ((this->actor.xzDistToPlayer < 250.0f) || this->actor.isLockedOn) { Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 5, 0x1000, 0x100); @@ -1329,7 +1329,7 @@ void EnSGoro_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); SkelAnime_Update(&this->skelAnime); if (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY) { EnSGoro_UpdateAttentionTarget(this, play); diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c index 597c2c392..6661796e6 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -473,7 +473,7 @@ void func_80ADBAB8(EnSellnuts* this, PlayState* play) { play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = func_80ADBBEC; - func_800B7298(play, NULL, PLAYER_CSMODE_19); + func_800B7298(play, NULL, PLAYER_CSACTION_19); } } diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.c b/src/overlays/actors/ovl_En_Shn/z_en_shn.c index 158c80087..1bdc7026a 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.c +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.c @@ -259,7 +259,7 @@ s32 func_80AE6704(Actor* thisx, PlayState* play) { case 6: CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40); - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_POISONED, 6); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index a18d56753..5c7f95a95 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -1345,7 +1345,7 @@ void EnSob1_Blink(EnSob1* this) { } void EnSob1_ChangeObject(EnSob1* this, PlayState* play) { - gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->shopkeeperAnimObjectSlot].segment); + gSegments[0x06] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->shopkeeperAnimObjectSlot].segment); } s32 EnSob1_AreObjectsLoaded(EnSob1* this, PlayState* play) { @@ -1364,7 +1364,7 @@ s32 EnSob1_AreObjectsLoaded(EnSob1* this, PlayState* play) { void EnSob1_ZoraShopkeeper_Init(EnSob1* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, ZORA_LIMB_MAX); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->shopkeeperAnimObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->shopkeeperAnimObjectSlot].segment); Animation_Change(&this->skelAnime, &gZoraShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gZoraShopkeeperAnim), ANIMMODE_LOOP, 0.0f); this->actor.draw = EnSob1_ZoraShopkeeper_Draw; @@ -1373,7 +1373,7 @@ void EnSob1_ZoraShopkeeper_Init(EnSob1* this, PlayState* play) { void EnSob1_GoronShopkeeper_Init(EnSob1* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, GORON_LIMB_MAX); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->shopkeeperAnimObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->shopkeeperAnimObjectSlot].segment); Animation_Change(&this->skelAnime, &gGoronShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGoronShopkeeperAnim), ANIMMODE_LOOP, 0.0f); this->actor.draw = EnSob1_GoronShopkeeper_Draw; diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index c7006f087..a4cec2e80 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -931,7 +931,7 @@ void EnSsh_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80976178[this->blinkState])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_K0(D_80976178[this->blinkState])); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSsh_OverrideLimbDraw, EnSsh_PostLimbDraw, &this->actor); diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index ba1828067..10f7c457c 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -245,7 +245,7 @@ void func_808A54B0(EnSt* this, PlayState* play) { if ((this->unk_18C & 1) && (this->actor.colChkInfo.health != 0)) { OPEN_DISPS(play->state.gfxCtx); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.slots[this->objectSlot].segment); diff --git a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c index 692651860..04eda15cb 100644 --- a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c +++ b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c @@ -322,7 +322,7 @@ void func_80ADF520(EnTakaraya* this, PlayState* play) { } void func_80ADF608(EnTakaraya* this, PlayState* play) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); this->unk2AD = true; this->actionFunc = func_80ADF654; } diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index db31d617e..1ee840b11 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -459,7 +459,7 @@ void EnTest3_Init(Actor* thisx, PlayState* play2) { this->player.heldItemId = ITEM_OCARINA_OF_TIME; Player_SetModelGroup(&this->player, 3); - play->playerInit(&this->player, play, &object_test3_Skel_00F7EC); + play->playerInit(&this->player, play, &gKafeiSkel); Effect_Add(play, &this->player.meleeWeaponEffectIndex[0], EFFECT_BLURE2, 0, 0, &sBlureInit); Effect_Add(play, &this->player.meleeWeaponEffectIndex[1], EFFECT_BLURE2, 0, 0, &sBlureInit); @@ -527,8 +527,8 @@ void func_80A3F0B0(EnTest3* this, PlayState* play) { } void func_80A3F114(EnTest3* this, PlayState* play) { - if (this->player.csMode != PLAYER_CSMODE_NONE) { - play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_END); + if (this->player.csAction != PLAYER_CSACTION_NONE) { + play->startPlayerCutscene(play, &this->player, PLAYER_CSACTION_END); } } @@ -668,7 +668,7 @@ s32 func_80A3F73C(EnTest3* this, PlayState* play) { func_800BC154(play, &play->actorCtx, &this->unk_D90->actor, 4); func_800BC154(play, &play->actorCtx, &this->player.actor, 2); CutsceneManager_SetReturnCamera(this->subCamId); - play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_WAIT); + play->startPlayerCutscene(play, &this->player, PLAYER_CSACTION_WAIT); } Actor_OfferTalkNearColChkInfoCylinder(&this->player.actor, play); if (this->unk_D88 == 3) { @@ -690,7 +690,7 @@ s32 func_80A3F8D4(EnTest3* this, PlayState* play, struct_80A41828* arg2, Schedul ((postActor = func_80A3F2BC(play, this, ACTOR_EN_PM, ACTORCAT_NPC, 100.0f, 20.0f)) != NULL)) { this->player.actor.home.rot.y = Actor_WorldYawTowardActor(&this->player.actor, postActor); } - play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_97); + play->startPlayerCutscene(play, &this->player, PLAYER_CSACTION_97); return true; } @@ -737,7 +737,7 @@ s32 func_80A3FA58(EnTest3* this, PlayState* play) { return false; } if (this->unk_D8A == 90) { - play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_21); + play->startPlayerCutscene(play, &this->player, PLAYER_CSACTION_21); } } else { this->unk_D8A++; @@ -857,7 +857,7 @@ s32 func_80A3FFD0(EnTest3* this, PlayState* play2) { } } else { SET_WEEKEVENTREG(WEEKEVENTREG_COUPLES_MASK_CUTSCENE_FINISHED); - play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_110); + play->startPlayerCutscene(play, &this->player, PLAYER_CSACTION_110); } return false; } @@ -1059,13 +1059,13 @@ void EnTest3_Update(Actor* thisx, PlayState* play2) { if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_506) && !((this->player.actor.category == ACTORCAT_PLAYER) && ((play->actorCtx.flags & ACTORCTX_FLAG_5) || (play->actorCtx.flags & ACTORCTX_FLAG_4)))) { - if (this->player.csMode != PLAYER_CSMODE_5) { - play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_5); + if (this->player.csAction != PLAYER_CSACTION_5) { + play->startPlayerCutscene(play, &this->player, PLAYER_CSACTION_5); } play->actorCtx.flags &= ~ACTORCTX_FLAG_4; } else if (this->player.actor.category == ACTORCAT_PLAYER) { func_80A409D4(this, play); - } else if (play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_NONE)) { + } else if (play->startPlayerCutscene(play, &this->player, PLAYER_CSACTION_NONE)) { if (this->unk_D88 >= 7) { Vec3f worldPos; @@ -1097,7 +1097,7 @@ s32 D_80A418C8 = false; s32 EnTest3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnTest3* this = THIS; - if (limbIndex == OBJECT_TEST3_LIMB_01) { + if (limbIndex == KAFEI_LIMB_ROOT) { D_80A41D6C = &this->player.bodyPartsPos[-1]; if (!(this->player.skelAnime.moveFlags & ANIM_FLAG_4) || (this->player.skelAnime.moveFlags & ANIM_FLAG_1)) { pos->x *= this->player.ageProperties->unk_08; @@ -1123,11 +1123,11 @@ s32 EnTest3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* if (D_80A418C8) { *dList = NULL; } - if (limbIndex == OBJECT_TEST3_LIMB_0B) { + if (limbIndex == KAFEI_LIMB_HEAD) { rot->x += this->player.headLimbRot.z; rot->y -= this->player.headLimbRot.y; rot->z += this->player.headLimbRot.x; - } else if (limbIndex == OBJECT_TEST3_LIMB_0A) { + } else if (limbIndex == KAFEI_LIMB_UPPER_ROOT) { s32 requiredScopeTemp; if (this->player.unk_AA8 != 0) { @@ -1155,7 +1155,7 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL if (*dList2 != NULL) { Matrix_MultZero(D_80A41D6C); } - if (limbIndex == OBJECT_TEST3_LIMB_10) { + if (limbIndex == KAFEI_LIMB_LEFT_HAND) { MtxF curMtxF; Actor* leftHandActor; @@ -1165,7 +1165,7 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL if (this->player.stateFlags3 & PLAYER_STATE3_20000000) { OPEN_DISPS(play->state.gfxCtx); - gSPDisplayList(POLY_OPA_DISP++, object_test3_DL_00EDD0); + gSPDisplayList(POLY_OPA_DISP++, gKafeiSunMaskDL); CLOSE_DISPS(play->state.gfxCtx); } @@ -1184,7 +1184,7 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL func_80126B8C(play, &this->player); } - } else if (limbIndex == OBJECT_TEST3_LIMB_13) { + } else if (limbIndex == KAFEI_LIMB_RIGHT_HAND) { Actor* leftHandActor = this->player.heldActor; if (leftHandActor != NULL) { @@ -1195,7 +1195,7 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL leftHandActor->world.pos.z = (this->player.bodyPartsPos[PLAYER_BODYPART_RIGHT_HAND].z + this->player.leftHandWorld.pos.z) / 2.0f; } - } else if (limbIndex == OBJECT_TEST3_LIMB_0B) { + } else if (limbIndex == KAFEI_LIMB_HEAD) { Actor* actor730 = this->player.lockOnActor; if ((*dList1 != NULL) && this->player.currentMask && !(this->player.stateFlags2 & PLAYER_STATE2_1000000)) { @@ -1219,7 +1219,7 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL Matrix_MultVec3f(&D_80A418CC, &this->player.actor.focus.pos); } - } else if (limbIndex == OBJECT_TEST3_LIMB_15) { + } else if (limbIndex == KAFEI_LIMB_TORSO) { if (D_80A41D60 || CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_PENDANT_OF_MEMORIES) || (INV_CONTENT(ITEM_PENDANT_OF_MEMORIES) == ITEM_PENDANT_OF_MEMORIES) || (this->player.getItemDrawIdPlusOne - 1 == GID_PENDANT_OF_MEMORIES)) { @@ -1227,7 +1227,7 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL } else { OPEN_DISPS(play->state.gfxCtx); - gSPDisplayList(POLY_OPA_DISP++, object_test3_DL_00CB60); + gSPDisplayList(POLY_OPA_DISP++, gKafeiPendantOfMemoriesDL); CLOSE_DISPS(play->state.gfxCtx); } @@ -1237,15 +1237,15 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL } static TexturePtr sEyeTextures[] = { - object_test3_Tex_000DC0, object_test3_Tex_003680, object_test3_Tex_003E80, object_test3_Tex_004680, - object_test3_Tex_004E80, object_test3_Tex_005680, object_test3_Tex_005E80, object_test3_Tex_006680, + gKafeiEyesOpenTex, gKafeiEyesHalfTex, gKafeiEyesClosedTex, gKafeiEyesRollRightTex, + gKafeiEyesRollLeftTex, gKafeiEyesRollUpTex, gKafeiEyesRollDownTex, object_test3_Tex_006680, }; static TexturePtr sMouthTextures[] = { - object_test3_Tex_0009C0, - object_test3_Tex_006E80, - object_test3_Tex_007280, - object_test3_Tex_007680, + gKafeiMouthClosedTex, + gKafeiMouthTeethTex, + gKafeiMouthAngryTex, + gKafeiMouthHappyTex, }; typedef struct { @@ -1261,8 +1261,8 @@ static KafeiFace sFaceExpressions[] = { void EnTest3_Draw(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnTest3* this = THIS; - s32 eyeTexIndex = (this->player.skelAnime.jointTable[OBJECT_TEST3_LIMB_MAX].x & 0xF) - 1; - s32 mouthTexIndex = ((this->player.skelAnime.jointTable[OBJECT_TEST3_LIMB_MAX].x >> 4) & 0xF) - 1; + s32 eyeTexIndex = GET_EYE_INDEX_FROM_JOINT_TABLE(this->player.skelAnime.jointTable); + s32 mouthTexIndex = GET_MOUTH_INDEX_FROM_JOINT_TABLE(this->player.skelAnime.jointTable); Gfx* gfx; OPEN_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index 9657f1b1e..52a0153c7 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -451,7 +451,7 @@ void EnTest6_StopInvertedSoTCutscene(EnTest6* this, PlayState* play) { player->actor.freezeTimer = 0; play->unk_18844 = false; CutsceneManager_Stop(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); - func_800B7298(play, NULL, PLAYER_CSMODE_END); + func_800B7298(play, NULL, PLAYER_CSACTION_END); EnTest6_DisableMotionBlur(); Distortion_RemoveRequest(DISTORTION_TYPE_SONG_OF_TIME); Actor_Kill(&this->actor); @@ -615,30 +615,30 @@ void EnTest6_InvertedSoTCutscene(EnTest6* this, PlayState* play) { // Update Player Cutscene Animation if (this->screenFillAlpha != 0) { - func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); + func_800B7298(play, NULL, PLAYER_CSACTION_WAIT); } else { if (this->timer == 90) { // Look side-to-side but downwards, with chin down // gPlayerAnim_al_elf_tobidasi - func_800B7298(play, NULL, PLAYER_CSMODE_66); + func_800B7298(play, NULL, PLAYER_CSACTION_66); } if (this->timer == 70) { // close eyes and sway body in circles // gPlayerAnim_alink_yurayura - func_800B7298(play, NULL, PLAYER_CSMODE_82); + func_800B7298(play, NULL, PLAYER_CSACTION_82); } if (this->timer == 30) { // Look side-to-side but upwards, with chin up // gPlayerAnim_alink_kyoro - func_800B7298(play, NULL, PLAYER_CSMODE_81); + func_800B7298(play, NULL, PLAYER_CSACTION_81); } if (this->timer == 5) { // Give a big nod of approval // gPlayerAnim_al_yes - func_800B7298(play, NULL, PLAYER_CSMODE_74); + func_800B7298(play, NULL, PLAYER_CSACTION_74); } } @@ -705,7 +705,7 @@ void EnTest6_StopDoubleSoTCutscene(EnTest6* this, PlayState* play) { player->actor.freezeTimer = 0; play->unk_18844 = false; CutsceneManager_Stop(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); - func_800B7298(play, NULL, PLAYER_CSMODE_END); + func_800B7298(play, NULL, PLAYER_CSACTION_END); EnTest6_DisableMotionBlur(); Distortion_RemoveRequest(DISTORTION_TYPE_SONG_OF_TIME); Actor_Kill(&this->actor); @@ -864,23 +864,23 @@ void EnTest6_DoubleSoTCutscene(EnTest6* this, PlayState* play) { break; case 98: - func_800B7298(play, NULL, PLAYER_CSMODE_64); + func_800B7298(play, NULL, PLAYER_CSACTION_64); break; case 68: - func_800B7298(play, NULL, PLAYER_CSMODE_65); + func_800B7298(play, NULL, PLAYER_CSACTION_65); break; case 52: - func_800B7298(play, NULL, PLAYER_CSMODE_88); + func_800B7298(play, NULL, PLAYER_CSACTION_88); break; case 43: - func_800B7298(play, NULL, PLAYER_CSMODE_114); + func_800B7298(play, NULL, PLAYER_CSACTION_114); break; case 38: - func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); + func_800B7298(play, NULL, PLAYER_CSACTION_WAIT); break; case 14: diff --git a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c index d99ee0bce..7d277a61f 100644 --- a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c +++ b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c @@ -301,7 +301,7 @@ void EnTimeTag_KickOut_Transition(EnTimeTag* this, PlayState* play) { */ void EnTimeTag_KickOut_WaitForTrigger(EnTimeTag* this, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); Message_StartTextbox(play, 0x1883 + TIMETAG_KICKOUT_GET_TEXT(&this->actor), NULL); this->actionFunc = EnTimeTag_KickOut_Transition; } @@ -334,7 +334,7 @@ void EnTimeTag_KickOut_WaitForTime(EnTimeTag* this, PlayState* play) { } } else if ((hour == TIMETAG_KICKOUT_HOUR(&this->actor)) && (minute == TIMETAG_KICKOUT_MINUTE(&this->actor)) && !Play_InCsMode(play)) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->actor, PLAYER_CSACTION_WAIT); Message_StartTextbox(play, 0x1883 + TIMETAG_KICKOUT_GET_TEXT(&this->actor), NULL); this->actionFunc = EnTimeTag_KickOut_Transition; } diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index 12aaa808f..75d880cd8 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -361,7 +361,7 @@ s32 func_80BA3ED4(EnToto* this, PlayState* play) { s32 func_80BA3EE8(EnToto* this, PlayState* play) { if (this->text->unk1 == 2) { - func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); + func_800B7298(play, NULL, PLAYER_CSACTION_WAIT); } return 0; } @@ -456,7 +456,7 @@ s32 func_80BA42BC(EnToto* this, PlayState* play) { Vec3s* end = &D_80BA510C[3]; func_80BA3FB0(this, play); - func_800B7298(play, NULL, PLAYER_CSMODE_END); + func_800B7298(play, NULL, PLAYER_CSACTION_END); if (player->actor.world.pos.z > -310.0f) { if ((player->actor.world.pos.x > -150.0f) || (player->actor.world.pos.z > -172.0f)) { phi_s0 = 3; @@ -476,7 +476,7 @@ s32 func_80BA42BC(EnToto* this, PlayState* play) { s32 func_80BA43F4(EnToto* this, PlayState* play) { func_80BA3C88(this); if (func_80122760(play, &this->unk_2BC, 60.0f)) { - func_800B7298(play, NULL, PLAYER_CSMODE_19); + func_800B7298(play, NULL, PLAYER_CSACTION_19); return func_80BA4204(this, play); } return 0; @@ -484,7 +484,7 @@ s32 func_80BA43F4(EnToto* this, PlayState* play) { s32 func_80BA445C(EnToto* this, PlayState* play) { if (func_80BA4128(this, play)) { - func_800B7298(play, NULL, PLAYER_CSMODE_END); + func_800B7298(play, NULL, PLAYER_CSACTION_END); return 1; } return 0; @@ -546,7 +546,7 @@ s32 func_80BA4530(EnToto* this, PlayState* play) { } s32 func_80BA46D8(EnToto* this, PlayState* play) { - func_800B7298(play, NULL, PLAYER_CSMODE_68); + func_800B7298(play, NULL, PLAYER_CSACTION_68); Message_DisplayOcarinaStaff(play, sOcarinaActionWindFishPrompts[CUR_FORM]); return 0; } @@ -603,8 +603,8 @@ s32 func_80BA47E0(EnToto* this, PlayState* play) { } s32 func_80BA49A4(EnToto* this, PlayState* play) { - func_800B7298(play, NULL, PLAYER_CSMODE_68); - func_801A31EC(NA_BGM_BALLAD_OF_THE_WIND_FISH, 4, this->unk2B3 ^ 0xF); + func_800B7298(play, NULL, PLAYER_CSACTION_68); + Audio_PlayFanfareWithPlayerIOCustomPort(NA_BGM_BALLAD_OF_THE_WIND_FISH, 4, this->unk2B3 ^ 0xF); this->unk2B1 = 4; return 0; } @@ -623,7 +623,7 @@ s32 func_80BA4A00(EnToto* this, PlayState* play) { if (this->spotlights != NULL) { Actor_Kill(this->spotlights); } - func_800B7298(play, NULL, PLAYER_CSMODE_69); + func_800B7298(play, NULL, PLAYER_CSACTION_69); if (this->unk2B3 == 0xF) { if (CURRENT_DAY == 1) { SET_WEEKEVENTREG(WEEKEVENTREG_50_01); diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index ca614643f..16fdd5cf2 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -457,7 +457,7 @@ void EnWallmas_SetupTakePlayer(EnWallmas* this, PlayState* play) { this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->yTarget = this->actor.playerHeightRel; - func_800B724C(play, &this->actor, PLAYER_CSMODE_18); + func_800B724C(play, &this->actor, PLAYER_CSACTION_18); } void EnWallmas_TakePlayer(EnWallmas* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c index fcac1e837..14469f556 100644 --- a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c +++ b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c @@ -97,10 +97,10 @@ void EnWarpTag_WaitForPlayer(EnWarptag* this, PlayState* play) { if (!Player_InCsMode(play) && (this->dyna.actor.xzDistToPlayer <= 30.0f) && (this->dyna.actor.playerHeightRel <= 10.0f)) { if (WARPTAG_GET_INVISIBLE(&this->dyna.actor)) { - func_800B7298(play, NULL, PLAYER_CSMODE_81); + func_800B7298(play, NULL, PLAYER_CSACTION_81); this->actionFunc = EnWarpTag_GrottoReturn; } else { - func_800B7298(play, NULL, PLAYER_CSMODE_15); + func_800B7298(play, NULL, PLAYER_CSACTION_15); this->actionFunc = EnWarpTag_RespawnPlayer; } } @@ -129,7 +129,7 @@ void EnWarpTag_Unused809C09A0(EnWarptag* this, PlayState* play) { */ void EnWarpTag_Unused809C0A20(EnWarptag* this, PlayState* play) { if (play->msgCtx.ocarinaMode == OCARINA_MODE_PLAYED_STORMS) { - func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); + func_800B7298(play, NULL, PLAYER_CSACTION_WAIT); this->actionFunc = EnWarpTag_RespawnPlayer; CutsceneManager_Stop(CutsceneManager_GetCurrentCsId()); @@ -247,7 +247,7 @@ void EnWarpTag_GrottoReturn(EnWarptag* this, PlayState* play) { Scene_SetExitFade(play); play->transitionTrigger = TRANS_TRIGGER_START; Audio_PlaySfx_2(NA_SE_OC_SECRET_HOLE_OUT); - func_801A4058(5); + Audio_MuteAllSeqExceptSystemAndOcarina(5); gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; } diff --git a/src/overlays/actors/ovl_En_Zod/z_en_zod.c b/src/overlays/actors/ovl_En_Zod/z_en_zod.c index f30aa51b8..c706e850d 100644 --- a/src/overlays/actors/ovl_En_Zod/z_en_zod.c +++ b/src/overlays/actors/ovl_En_Zod/z_en_zod.c @@ -480,7 +480,7 @@ void func_80BAFDB4(EnZod* this, PlayState* play) { EnZod_UpdateAnimation(this); if (CutsceneManager_IsNext(this->actor.csId)) { CutsceneManager_Start(this->actor.csId, &this->actor); - func_800B7298(play, NULL, PLAYER_CSMODE_68); + func_800B7298(play, NULL, PLAYER_CSACTION_68); Message_StartTextbox(play, 0x103A, &this->actor); this->actionFunc = EnZod_SetupRehearse; } else { diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index d5ec2917a..7a8272c83 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -593,7 +593,7 @@ void func_809381C4(ObjBean* this, PlayState* play) { if (CutsceneManager_IsNext(this->dyna.actor.csId)) { CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); if (this->dyna.actor.csId >= 0) { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_1); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_1); } this->unk_1E4 = 2; func_80938284(this); @@ -750,7 +750,7 @@ void func_80938780(ObjBean* this, PlayState* play) { if (CutsceneManager_IsNext(this->dyna.actor.csId)) { CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); if (this->dyna.actor.csId >= 0) { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_1); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_1); } this->unk_1B4 = 36; func_80937130(this); diff --git a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c index cf2ef3ded..a4640c476 100644 --- a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c +++ b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c @@ -134,7 +134,7 @@ void ObjBoat_Update(Actor* thisx, PlayState* play) { } } - if (player->csMode != PLAYER_CSMODE_26) { + if (player->csAction != PLAYER_CSACTION_26) { Math_ScaledStepToS(&this->dyna.actor.shape.rot.y, yawTarget, (s32)(fabsf(this->dyna.actor.speed) * 40.0f)); this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y; Math_StepToF(&this->dyna.actor.speed, speedTarget, 0.05f); diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index 4227178e2..8f9f21ddf 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -495,7 +495,7 @@ void func_8098E0B8(ObjComb* this, PlayState* play) { if ((this->unk_1B4 == 10) && (this->unk_1B6 != 0) && (this->unk_1B5 == 2) && (this->actor.csId >= 0)) { if (CutsceneManager_GetCurrentCsId() == this->actor.csId) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_4); + func_800B7298(play, &this->actor, PLAYER_CSACTION_4); } } } @@ -529,7 +529,7 @@ void ObjComb_Update(Actor* thisx, PlayState* play) { if (CutsceneManager_IsNext(this->actor.csId)) { CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); if (this->actor.csId >= 0) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_1); + func_800B7298(play, &this->actor, PLAYER_CSACTION_1); } if (((OBJCOMB_GET_8000(&this->actor) | OBJCOMB_GET_80(&this->actor)) == 1) && diff --git a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c index edeb9e269..6216fa6c8 100644 --- a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c +++ b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c @@ -1209,7 +1209,7 @@ void func_80A25FD4(ObjIceblock* this, PlayState* play) { func_80A23370(this, sp2C); func_80A260E8(this); sp30 = false; - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_WAIT); this->unk_1B0 |= 1; } @@ -1255,7 +1255,7 @@ void func_80A26144(ObjIceblock* this, PlayState* play) { if ((this->unk_1B0 & 1) && (isBool || sp28 || (this->dyna.actor.xzDistToPlayer > 400.0f))) { this->unk_1B0 &= ~1; - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_END); } if (isBool) { @@ -1454,7 +1454,7 @@ void ObjIceblock_Update(Actor* thisx, PlayState* play) { this->unk_1B0 &= ~0x100; if (this->unk_1B0 & 1) { this->unk_1B0 &= ~1; - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_END); } func_80A266C4(this); } diff --git a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c index c7605c825..56b23e839 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -130,7 +130,7 @@ void func_8099FD7C(Actor* thisx, PlayState* play) { if (CutsceneManager_IsNext(thisx->csId)) { CutsceneManager_StartWithPlayerCs(thisx->csId, thisx); if (thisx->csId >= 0) { - func_800B7298(play, thisx, PLAYER_CSMODE_4); + func_800B7298(play, thisx, PLAYER_CSACTION_4); } func_8099FB64(thisx, play); thisx->update = Actor_Noop; diff --git a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c index 09dd82441..6f16c9e50 100644 --- a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c +++ b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c @@ -535,7 +535,7 @@ void func_80A22334(ObjSkateblock* this, PlayState* play) { func_80A21C88(this, sp2C); func_80A2244C(this); sp30 = false; - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_WAIT); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_WAIT); this->unk_1C1 |= 1; } @@ -591,7 +591,7 @@ void func_80A224A4(ObjSkateblock* this, PlayState* play) { if ((this->unk_1C1 & 1) && (sp24 || sp28 || (this->dyna.actor.xzDistToPlayer > 400.0f))) { this->unk_1C1 &= ~1; - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_END); } func_80A21F74(this, play); diff --git a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c index 785a3ea5a..bb13f0601 100644 --- a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c +++ b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c @@ -679,7 +679,7 @@ void func_80B30A4C(ObjSpidertent* this, PlayState* play) { if (CutsceneManager_IsNext(this->dyna.actor.csId)) { CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); if (this->dyna.actor.csId >= 0) { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_1); + func_800B7298(play, &this->dyna.actor, PLAYER_CSACTION_1); } Flags_SetSwitch(play, OBJSPIDERTENT_GET_SWITCH_FLAG(&this->dyna.actor)); func_80B30AD4(this); diff --git a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c index a44f2cbb1..f4b5ca225 100644 --- a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c +++ b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c @@ -73,7 +73,7 @@ void func_808A7AAC(ObjWturn* this, PlayState* play) { CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); Play_EnableMotionBlur(140); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->actor.csId); - func_800B7298(play, &this->actor, PLAYER_CSMODE_21); + func_800B7298(play, &this->actor, PLAYER_CSACTION_21); subCamAt.x = player->actor.focus.pos.x; subCamAt.z = player->actor.focus.pos.z; subCamAt.y = player->actor.focus.pos.y; @@ -97,7 +97,7 @@ void func_808A7C04(ObjWturn* this, PlayState* play) { this->actor.world.pos.y += this->actor.playerHeightRel; player->actor.shape.shadowAlpha = 0; - func_800B7298(play, &this->actor, PLAYER_CSMODE_84); + func_800B7298(play, &this->actor, PLAYER_CSACTION_84); Player_PlaySfx(player, NA_SE_VO_NAVY_ENEMY); this->unk_14A = 0; Play_DisableMotionBlur(); diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 43021a023..07a18db57 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -52,7 +52,7 @@ void Player_Update(Actor* thisx, PlayState* play); void Player_Draw(Actor* thisx, PlayState* play); s32 Player_GrabPlayer(PlayState* play, Player* this); -s32 func_8085B28C(PlayState* play, Player* this, PlayerCsMode csMode); +s32 func_8085B28C(PlayState* play, Player* this, PlayerCsAction csAction); void func_8085B384(Player* this, PlayState* play); s32 Player_InflictDamage(PlayState* play, s32 damage); void Player_TalkWithPlayer(PlayState* play, Actor* actor); @@ -353,7 +353,7 @@ typedef struct BlureColors { } BlureColors; // size = 0x10 typedef void (*PlayerCsAnim)(PlayState*, Player*, void*); -typedef void (*PlayerCsAction)(PlayState*, Player*, CsCmdActorCue*); +typedef void (*PlayerCsActionFunc)(PlayState*, Player*, CsCmdActorCue*); typedef enum { /* -1 */ PLAYER_CSTYPE_ACTION = -1, @@ -379,17 +379,17 @@ typedef enum { /* 0x13 */ PLAYER_CSTYPE_ANIM_19 } PlayerCsType; -typedef struct PlayerCsModeEntry { +typedef struct PlayerCsActionEntry { /* 0x0 */ s8 type; // PlayerCsType enum /* 0x4 */ union { void* ptr; // Do not use, required in the absence of designated initialisors - PlayerCsAction csActionFunc; + PlayerCsActionFunc csActionFunc; void* csAnimArg2; // Can point to any of the below in the union PlayerAnimationHeader* anim; AnimSfxEntry* entry; CsCmdActorCue* cue; }; -} PlayerCsModeEntry; // size = 0x8 +} PlayerCsActionEntry; // size = 0x8 typedef struct struct_8085E368 { /* 0x0 */ Vec3s base; @@ -3797,7 +3797,7 @@ void Player_UpdateItems(Player* this, PlayState* play) { if ((this->actor.id == ACTOR_PLAYER) && !(this->stateFlags3 & PLAYER_STATE3_START_CHANGING_HELD_ITEM)) { if ((this->heldItemAction == this->itemAction) || (this->stateFlags1 & PLAYER_STATE1_400000)) { if ((gSaveContext.save.saveInfo.playerData.health != 0) && (play->csCtx.state == CS_STATE_IDLE)) { - if ((this->csMode == PLAYER_CSMODE_NONE) && (play->unk_1887C == 0) && + if ((this->csAction == PLAYER_CSACTION_NONE) && (play->unk_1887C == 0) && (play->activeCamId == CAM_ID_MAIN)) { if (!func_8082DA90(play) && (gSaveContext.timerStates[TIMER_ID_MINIGAME_2] != TIMER_STATE_STOP)) { Player_ProcessItemButtons(this, play); @@ -4504,7 +4504,7 @@ void func_80831F34(PlayState* play, Player* this, PlayerAnimationHeader* anim) { this->actionVar1 = 1; } else { play->gameOverCtx.state = GAMEOVER_DEATH_START; - func_801A41F8(0); + Audio_StopFanfare(0); Audio_PlayFanfare(NA_BGM_GAME_OVER); gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; @@ -4698,7 +4698,7 @@ void func_80832888(Player* this, PlayState* play) { this->stateFlags1 &= ~PLAYER_STATE1_40000000; } - if ((play->csCtx.state != CS_STATE_IDLE) || (this->csMode != PLAYER_CSMODE_NONE) || + if ((play->csCtx.state != CS_STATE_IDLE) || (this->csAction != PLAYER_CSACTION_NONE) || (this->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_20000000)) || (this->stateFlags3 & PLAYER_STATE3_80)) { this->unk_738 = 0; } else if (heldZ || (this->stateFlags2 & PLAYER_STATE2_2000) || (this->unk_A78 != NULL)) { @@ -5791,7 +5791,7 @@ s32 func_80834600(Player* this, PlayState* play) { return false; } else if ((this->unk_D6B != 0) || (this->invincibilityTimer > 0) || (this->stateFlags1 & PLAYER_STATE1_4000000) || - (this->csMode != PLAYER_CSMODE_NONE) || (this->meleeWeaponQuads[0].base.atFlags & AT_HIT) || + (this->csAction != PLAYER_CSACTION_NONE) || (this->meleeWeaponQuads[0].base.atFlags & AT_HIT) || (this->meleeWeaponQuads[1].base.atFlags & AT_HIT) || (this->cylinder.base.atFlags & AT_HIT) || (this->shieldCylinder.base.atFlags & AT_HIT)) { return false; @@ -6094,7 +6094,7 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol s32 sp30; if ((this == GET_PLAYER(play)) && !(this->stateFlags1 & PLAYER_STATE1_80) && !func_8082DA90(play) && - (this->csMode == PLAYER_CSMODE_NONE) && !(this->stateFlags1 & PLAYER_STATE1_1)) { + (this->csAction == PLAYER_CSACTION_NONE) && !(this->stateFlags1 & PLAYER_STATE1_1)) { exitIndexPlusOne = 0; if (((poly != NULL) && @@ -6128,7 +6128,7 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol if ((this->stateFlags1 & PLAYER_STATE1_8000000) && (this->floorProperty == FLOOR_PROPERTY_5)) { Audio_PlaySfx_2(NA_SE_OC_TUNAMI); - func_801A4058(5); + Audio_MuteAllSeqExceptSystemAndOcarina(5); gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; } else if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && @@ -6150,7 +6150,7 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol ((sp34 < 100) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) { if (floorType == FLOOR_TYPE_11) { Audio_PlaySfx_2(NA_SE_OC_SECRET_HOLE_OUT); - func_801A4058(5); + Audio_MuteAllSeqExceptSystemAndOcarina(5); gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; } else { @@ -6694,7 +6694,7 @@ s32 func_80836F10(PlayState* play, Player* this) { s32 fallDistance; if ((sPlayerFloorType == FLOOR_TYPE_6) || (sPlayerFloorType == FLOOR_TYPE_9) || - (this->csMode != PLAYER_CSMODE_NONE)) { + (this->csAction != PLAYER_CSACTION_NONE)) { fallDistance = 0; } else { fallDistance = this->fallDistance; @@ -8565,9 +8565,9 @@ void func_8083BB4C(PlayState* play, Player* this) { if ((this->transformation == PLAYER_FORM_ZORA) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->currentBoots = PLAYER_BOOTS_ZORA_LAND; } - func_801A3E38(0); + Audio_SetBaseFilter(0); } else { - func_801A3E38(0x20); + Audio_SetBaseFilter(0x20); if ((this->transformation == PLAYER_FORM_ZORA) || (sp1C < 10.0f)) { this->underwaterTimer = 0; } else if (this->underwaterTimer < 300) { @@ -9085,7 +9085,7 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) { func_8083D168(play, this, giEntry); this->getItemId = GI_NONE; } - } else if (this->csMode == PLAYER_CSMODE_NONE) { + } else if (this->csAction == PLAYER_CSACTION_NONE) { if (!(this->stateFlags1 & PLAYER_STATE1_800)) { if (this->getItemId != GI_NONE) { if (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A)) { @@ -10740,7 +10740,7 @@ void Player_Init(Actor* thisx, PlayState* play) { tireMark->color = D_8085D33C; } - if ((this->csMode == PLAYER_CSMODE_9) || (this->csMode == PLAYER_CSMODE_93)) { + if ((this->csAction == PLAYER_CSACTION_9) || (this->csAction == PLAYER_CSACTION_93)) { Player_SetAction(play, this, Player_Action_97, 0); this->stateFlags1 |= PLAYER_STATE1_20000000; } else { @@ -10778,7 +10778,7 @@ void Player_Init(Actor* thisx, PlayState* play) { if (this->actor.shape.rot.x != 0) { this->actor.shape.rot.x = 0; - this->csMode = PLAYER_CSMODE_68; + this->csAction = PLAYER_CSACTION_68; Player_SetAction(play, this, Player_Action_97, 0); this->stateFlags1 |= PLAYER_STATE1_20000000; return; @@ -11241,7 +11241,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { this->floorProperty = SurfaceType_GetFloorProperty(&play->colCtx, floorPoly, this->actor.floorBgId); if (this == GET_PLAYER(play)) { - func_801A3CF4(SurfaceType_GetEcho(&play->colCtx, floorPoly, this->actor.floorBgId)); + Audio_SetCodeReverb(SurfaceType_GetEcho(&play->colCtx, floorPoly, this->actor.floorBgId)); if (this->actor.floorBgId == BGCHECK_SCENE) { Environment_ChangeLightSetting( @@ -11475,7 +11475,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { seqMode = SEQ_MODE_DEFAULT; if (this->stateFlags1 & PLAYER_STATE1_100000) { seqMode = SEQ_MODE_STILL; - } else if (this->csMode != PLAYER_CSMODE_NONE) { + } else if (this->csAction != PLAYER_CSACTION_NONE) { Camera_ChangeMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_NORMAL); } else { camera = (this->actor.id == ACTOR_PLAYER) ? Play_GetCamera(play, CAM_ID_MAIN) @@ -11654,103 +11654,101 @@ void Player_DetectSecrets(PlayState* play, Player* this) { } } -// Making a player csMode negative will behave as its positive counterpart +// Making a player csAction negative will behave as its positive counterpart // except will disable setting the start position -#define DISABLE_PLAYER_CSMODE_START_POS(csMode) -(csMode) - -s8 sPlayerCsModes[PLAYER_CUEID_MAX] = { - /* PLAYER_CUEID_NONE */ PLAYER_CSMODE_NONE, - /* PLAYER_CUEID_1 */ PLAYER_CSMODE_2, - /* PLAYER_CUEID_2 */ PLAYER_CSMODE_2, - /* PLAYER_CUEID_3 */ PLAYER_CSMODE_4, - /* PLAYER_CUEID_4 */ PLAYER_CSMODE_3, - /* PLAYER_CUEID_5 */ PLAYER_CSMODE_56, - /* PLAYER_CUEID_6 */ PLAYER_CSMODE_8, - /* PLAYER_CUEID_7 */ PLAYER_CSMODE_NONE, - /* PLAYER_CUEID_8 */ PLAYER_CSMODE_NONE, - /* PLAYER_CUEID_9 */ PLAYER_CSMODE_135, - /* PLAYER_CUEID_10 */ PLAYER_CSMODE_21, - /* PLAYER_CUEID_11 */ PLAYER_CSMODE_61, - /* PLAYER_CUEID_12 */ PLAYER_CSMODE_62, - /* PLAYER_CUEID_13 */ PLAYER_CSMODE_60, - /* PLAYER_CUEID_14 */ PLAYER_CSMODE_63, - /* PLAYER_CUEID_15 */ PLAYER_CSMODE_64, - /* PLAYER_CUEID_16 */ PLAYER_CSMODE_65, - /* PLAYER_CUEID_17 */ PLAYER_CSMODE_66, - /* PLAYER_CUEID_18 */ PLAYER_CSMODE_70, - /* PLAYER_CUEID_19 */ PLAYER_CSMODE_19, - /* PLAYER_CUEID_20 */ PLAYER_CSMODE_71, - /* PLAYER_CUEID_21 */ PLAYER_CSMODE_72, - /* PLAYER_CUEID_22 */ PLAYER_CSMODE_67, - /* PLAYER_CUEID_23 */ PLAYER_CSMODE_73, - /* PLAYER_CUEID_24 */ PLAYER_CSMODE_74, - /* PLAYER_CUEID_25 */ PLAYER_CSMODE_75, - /* PLAYER_CUEID_26 */ PLAYER_CSMODE_68, - /* PLAYER_CUEID_27 */ PLAYER_CSMODE_69, - /* PLAYER_CUEID_28 */ PLAYER_CSMODE_76, - /* PLAYER_CUEID_29 */ PLAYER_CSMODE_116, - /* PLAYER_CUEID_30 */ PLAYER_CSMODE_NONE, - /* PLAYER_CUEID_31 */ PLAYER_CSMODE_40, - /* PLAYER_CUEID_32 */ PLAYER_CSMODE_NONE, - /* PLAYER_CUEID_33 */ DISABLE_PLAYER_CSMODE_START_POS(PLAYER_CSMODE_52), - /* PLAYER_CUEID_34 */ PLAYER_CSMODE_42, - /* PLAYER_CUEID_35 */ PLAYER_CSMODE_43, - /* PLAYER_CUEID_36 */ PLAYER_CSMODE_57, - /* PLAYER_CUEID_37 */ PLAYER_CSMODE_81, - /* PLAYER_CUEID_38 */ PLAYER_CSMODE_41, - /* PLAYER_CUEID_39 */ PLAYER_CSMODE_53, - /* PLAYER_CUEID_40 */ PLAYER_CSMODE_54, - /* PLAYER_CUEID_41 */ PLAYER_CSMODE_44, - /* PLAYER_CUEID_42 */ PLAYER_CSMODE_55, - /* PLAYER_CUEID_43 */ PLAYER_CSMODE_45, - /* PLAYER_CUEID_44 */ PLAYER_CSMODE_46, - /* PLAYER_CUEID_45 */ PLAYER_CSMODE_47, - /* PLAYER_CUEID_46 */ PLAYER_CSMODE_48, - /* PLAYER_CUEID_47 */ PLAYER_CSMODE_49, - /* PLAYER_CUEID_48 */ PLAYER_CSMODE_50, - /* PLAYER_CUEID_49 */ PLAYER_CSMODE_51, - /* PLAYER_CUEID_50 */ PLAYER_CSMODE_77, - /* PLAYER_CUEID_51 */ PLAYER_CSMODE_78, - /* PLAYER_CUEID_52 */ PLAYER_CSMODE_79, - /* PLAYER_CUEID_53 */ PLAYER_CSMODE_80, - /* PLAYER_CUEID_54 */ PLAYER_CSMODE_81, - /* PLAYER_CUEID_55 */ PLAYER_CSMODE_82, - /* PLAYER_CUEID_56 */ PLAYER_CSMODE_83, - /* PLAYER_CUEID_57 */ PLAYER_CSMODE_84, - /* PLAYER_CUEID_58 */ PLAYER_CSMODE_85, - /* PLAYER_CUEID_59 */ PLAYER_CSMODE_86, - /* PLAYER_CUEID_60 */ PLAYER_CSMODE_87, - /* PLAYER_CUEID_61 */ PLAYER_CSMODE_88, - /* PLAYER_CUEID_62 */ PLAYER_CSMODE_89, - /* PLAYER_CUEID_63 */ PLAYER_CSMODE_90, - /* PLAYER_CUEID_64 */ PLAYER_CSMODE_91, - /* PLAYER_CUEID_65 */ PLAYER_CSMODE_92, - /* PLAYER_CUEID_66 */ PLAYER_CSMODE_94, - /* PLAYER_CUEID_67 */ PLAYER_CSMODE_95, - /* PLAYER_CUEID_68 */ PLAYER_CSMODE_100, - /* PLAYER_CUEID_69 */ PLAYER_CSMODE_101, - /* PLAYER_CUEID_70 */ PLAYER_CSMODE_98, - /* PLAYER_CUEID_71 */ PLAYER_CSMODE_99, - /* PLAYER_CUEID_72 */ PLAYER_CSMODE_102, - /* PLAYER_CUEID_73 */ PLAYER_CSMODE_103, - /* PLAYER_CUEID_74 */ PLAYER_CSMODE_104, - /* PLAYER_CUEID_75 */ PLAYER_CSMODE_112, - /* PLAYER_CUEID_76 */ PLAYER_CSMODE_113, - /* PLAYER_CUEID_77 */ PLAYER_CSMODE_117, - /* PLAYER_CUEID_78 */ PLAYER_CSMODE_104, - /* PLAYER_CUEID_79 */ PLAYER_CSMODE_104, - /* PLAYER_CUEID_80 */ PLAYER_CSMODE_105, - /* PLAYER_CUEID_81 */ PLAYER_CSMODE_106, - /* PLAYER_CUEID_82 */ PLAYER_CSMODE_107, - /* PLAYER_CUEID_83 */ PLAYER_CSMODE_108, - /* PLAYER_CUEID_84 */ PLAYER_CSMODE_109, - /* PLAYER_CUEID_85 */ PLAYER_CSMODE_110, - /* PLAYER_CUEID_86 */ PLAYER_CSMODE_118, - /* PLAYER_CUEID_87 */ PLAYER_CSMODE_119, - /* PLAYER_CUEID_88 */ PLAYER_CSMODE_120, - /* PLAYER_CUEID_89 */ PLAYER_CSMODE_114, - /* PLAYER_CUEID_90 */ PLAYER_CSMODE_111, - /* PLAYER_CUEID_91 */ PLAYER_CSMODE_122, +s8 sPlayerCueToCsActionMap[PLAYER_CUEID_MAX] = { + PLAYER_CSACTION_NONE, // PLAYER_CUEID_NONE + PLAYER_CSACTION_2, // PLAYER_CUEID_1 + PLAYER_CSACTION_2, // PLAYER_CUEID_2 + PLAYER_CSACTION_4, // PLAYER_CUEID_3 + PLAYER_CSACTION_3, // PLAYER_CUEID_4 + PLAYER_CSACTION_56, // PLAYER_CUEID_5 + PLAYER_CSACTION_8, // PLAYER_CUEID_6 + PLAYER_CSACTION_NONE, // PLAYER_CUEID_7 + PLAYER_CSACTION_NONE, // PLAYER_CUEID_8 + PLAYER_CSACTION_135, // PLAYER_CUEID_9 + PLAYER_CSACTION_21, // PLAYER_CUEID_10 + PLAYER_CSACTION_61, // PLAYER_CUEID_11 + PLAYER_CSACTION_62, // PLAYER_CUEID_12 + PLAYER_CSACTION_60, // PLAYER_CUEID_13 + PLAYER_CSACTION_63, // PLAYER_CUEID_14 + PLAYER_CSACTION_64, // PLAYER_CUEID_15 + PLAYER_CSACTION_65, // PLAYER_CUEID_16 + PLAYER_CSACTION_66, // PLAYER_CUEID_17 + PLAYER_CSACTION_70, // PLAYER_CUEID_18 + PLAYER_CSACTION_19, // PLAYER_CUEID_19 + PLAYER_CSACTION_71, // PLAYER_CUEID_20 + PLAYER_CSACTION_72, // PLAYER_CUEID_21 + PLAYER_CSACTION_67, // PLAYER_CUEID_22 + PLAYER_CSACTION_73, // PLAYER_CUEID_23 + PLAYER_CSACTION_74, // PLAYER_CUEID_24 + PLAYER_CSACTION_75, // PLAYER_CUEID_25 + PLAYER_CSACTION_68, // PLAYER_CUEID_26 + PLAYER_CSACTION_69, // PLAYER_CUEID_27 + PLAYER_CSACTION_76, // PLAYER_CUEID_28 + PLAYER_CSACTION_116, // PLAYER_CUEID_29 + PLAYER_CSACTION_NONE, // PLAYER_CUEID_30 + PLAYER_CSACTION_40, // PLAYER_CUEID_31 + PLAYER_CSACTION_NONE, // PLAYER_CUEID_32 + -PLAYER_CSACTION_52, // PLAYER_CUEID_33 + PLAYER_CSACTION_42, // PLAYER_CUEID_34 + PLAYER_CSACTION_43, // PLAYER_CUEID_35 + PLAYER_CSACTION_57, // PLAYER_CUEID_36 + PLAYER_CSACTION_81, // PLAYER_CUEID_37 + PLAYER_CSACTION_41, // PLAYER_CUEID_38 + PLAYER_CSACTION_53, // PLAYER_CUEID_39 + PLAYER_CSACTION_54, // PLAYER_CUEID_40 + PLAYER_CSACTION_44, // PLAYER_CUEID_41 + PLAYER_CSACTION_55, // PLAYER_CUEID_42 + PLAYER_CSACTION_45, // PLAYER_CUEID_43 + PLAYER_CSACTION_46, // PLAYER_CUEID_44 + PLAYER_CSACTION_47, // PLAYER_CUEID_45 + PLAYER_CSACTION_48, // PLAYER_CUEID_46 + PLAYER_CSACTION_49, // PLAYER_CUEID_47 + PLAYER_CSACTION_50, // PLAYER_CUEID_48 + PLAYER_CSACTION_51, // PLAYER_CUEID_49 + PLAYER_CSACTION_77, // PLAYER_CUEID_50 + PLAYER_CSACTION_78, // PLAYER_CUEID_51 + PLAYER_CSACTION_79, // PLAYER_CUEID_52 + PLAYER_CSACTION_80, // PLAYER_CUEID_53 + PLAYER_CSACTION_81, // PLAYER_CUEID_54 + PLAYER_CSACTION_82, // PLAYER_CUEID_55 + PLAYER_CSACTION_83, // PLAYER_CUEID_56 + PLAYER_CSACTION_84, // PLAYER_CUEID_57 + PLAYER_CSACTION_85, // PLAYER_CUEID_58 + PLAYER_CSACTION_86, // PLAYER_CUEID_59 + PLAYER_CSACTION_87, // PLAYER_CUEID_60 + PLAYER_CSACTION_88, // PLAYER_CUEID_61 + PLAYER_CSACTION_89, // PLAYER_CUEID_62 + PLAYER_CSACTION_90, // PLAYER_CUEID_63 + PLAYER_CSACTION_91, // PLAYER_CUEID_64 + PLAYER_CSACTION_92, // PLAYER_CUEID_65 + PLAYER_CSACTION_94, // PLAYER_CUEID_66 + PLAYER_CSACTION_95, // PLAYER_CUEID_67 + PLAYER_CSACTION_100, // PLAYER_CUEID_68 + PLAYER_CSACTION_101, // PLAYER_CUEID_69 + PLAYER_CSACTION_98, // PLAYER_CUEID_70 + PLAYER_CSACTION_99, // PLAYER_CUEID_71 + PLAYER_CSACTION_102, // PLAYER_CUEID_72 + PLAYER_CSACTION_103, // PLAYER_CUEID_73 + PLAYER_CSACTION_104, // PLAYER_CUEID_74 + PLAYER_CSACTION_112, // PLAYER_CUEID_75 + PLAYER_CSACTION_113, // PLAYER_CUEID_76 + PLAYER_CSACTION_117, // PLAYER_CUEID_77 + PLAYER_CSACTION_104, // PLAYER_CUEID_78 + PLAYER_CSACTION_104, // PLAYER_CUEID_79 + PLAYER_CSACTION_105, // PLAYER_CUEID_80 + PLAYER_CSACTION_106, // PLAYER_CUEID_81 + PLAYER_CSACTION_107, // PLAYER_CUEID_82 + PLAYER_CSACTION_108, // PLAYER_CUEID_83 + PLAYER_CSACTION_109, // PLAYER_CUEID_84 + PLAYER_CSACTION_110, // PLAYER_CUEID_85 + PLAYER_CSACTION_118, // PLAYER_CUEID_86 + PLAYER_CSACTION_119, // PLAYER_CUEID_87 + PLAYER_CSACTION_120, // PLAYER_CUEID_88 + PLAYER_CSACTION_114, // PLAYER_CUEID_89 + PLAYER_CSACTION_111, // PLAYER_CUEID_90 + PLAYER_CSACTION_122, // PLAYER_CUEID_91 }; f32 D_8085D3E0[PLAYER_FORM_MAX] = { @@ -12141,29 +12139,29 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { } if (play->csCtx.state != CS_STATE_IDLE) { - if ((this->csMode != PLAYER_CSMODE_5) && !(this->stateFlags1 & PLAYER_STATE1_800000)) { + if ((this->csAction != PLAYER_CSACTION_5) && !(this->stateFlags1 & PLAYER_STATE1_800000)) { if (!(this->stateFlags2 & PLAYER_STATE2_80) && (this->actor.id == ACTOR_PLAYER)) { if ((play->csCtx.playerCue != NULL) && - (sPlayerCsModes[play->csCtx.playerCue->id] != PLAYER_CSMODE_NONE)) { - func_800B7298(play, NULL, PLAYER_CSMODE_5); + (sPlayerCueToCsActionMap[play->csCtx.playerCue->id] != PLAYER_CSACTION_NONE)) { + func_800B7298(play, NULL, PLAYER_CSACTION_5); Player_StopHorizontalMovement(this); - } else if (((u32)this->csMode == PLAYER_CSMODE_NONE) && + } else if (((u32)this->csAction == PLAYER_CSACTION_NONE) && !(this->stateFlags2 & (PLAYER_STATE2_400 | PLAYER_STATE2_8000000)) && (play->csCtx.state != CS_STATE_STOP)) { - func_800B7298(play, NULL, PLAYER_CSMODE_20); + func_800B7298(play, NULL, PLAYER_CSACTION_20); Player_StopHorizontalMovement(this); } } } } - if ((u32)this->csMode != PLAYER_CSMODE_NONE) { - if ((this->csMode != PLAYER_CSMODE_END) || + if ((u32)this->csAction != PLAYER_CSACTION_NONE) { + if ((this->csAction != PLAYER_CSACTION_END) || !(this->stateFlags1 & (PLAYER_STATE1_4 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_200000 | PLAYER_STATE1_4000000))) { if (Player_Action_97 != this->actionFunc) { this->unk_AA5 = PLAYER_UNKAA5_4; - if (this->csMode == PLAYER_CSMODE_5) { + if (this->csAction == PLAYER_CSACTION_5) { func_808387A0(play, this); func_8082DAD4(this); } @@ -12172,7 +12170,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { Player_CsAction_End(play, this, NULL); } } else { - this->prevCsMode = PLAYER_CSMODE_NONE; + this->prevCsAction = PLAYER_CSACTION_NONE; } func_8083BF54(play, this); @@ -12323,7 +12321,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { !(this->stateFlags3 & PLAYER_STATE3_10000000)) { if ((Player_Action_93 != this->actionFunc) && (Player_Action_73 != this->actionFunc) && (this->actor.draw != NULL)) { - if ((this->actor.id != ACTOR_PLAYER) && (this->csMode == PLAYER_CSMODE_110)) { + if ((this->actor.id != ACTOR_PLAYER) && (this->csAction == PLAYER_CSACTION_110)) { this->cylinder.dim.radius = 8; } CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinder.base); @@ -12410,9 +12408,9 @@ void Player_Update(Actor* thisx, PlayState* play) { if ((play->actorCtx.unk268 != 0) && (this == GET_PLAYER(play))) { input = play->actorCtx.unk_26C; - } else if ((this->csMode == PLAYER_CSMODE_5) || (this->stateFlags1 & (PLAYER_STATE1_20 | PLAYER_STATE1_20000000)) || - (this != GET_PLAYER(play)) || func_8082DA90(play) || - (gSaveContext.save.saveInfo.playerData.health == 0)) { + } else if ((this->csAction == PLAYER_CSACTION_5) || + (this->stateFlags1 & (PLAYER_STATE1_20 | PLAYER_STATE1_20000000)) || (this != GET_PLAYER(play)) || + func_8082DA90(play) || (gSaveContext.save.saveInfo.playerData.health == 0)) { bzero(&input, sizeof(Input)); this->fallStartHeight = this->actor.world.pos.y; } else { @@ -12676,7 +12674,7 @@ void Player_Draw(Actor* thisx, PlayState* play) { NULL, NULL, NULL); } else { OverrideLimbDrawFlex sp84 = Player_OverrideLimbDrawGameplayDefault; - s32 lod = ((this->csMode != PLAYER_CSMODE_NONE) || (this->actor.projectedPos.z < 320.0f)) ? 0 : 1; + s32 lod = ((this->csAction != PLAYER_CSACTION_NONE) || (this->actor.projectedPos.z < 320.0f)) ? 0 : 1; Vec3f sp74; //! FAKE @@ -12892,7 +12890,7 @@ s32 func_80847880(PlayState* play, Player* this) { if (play->sceneId == SCENE_20SICHITAI) { Player_SetAction(play, this, Player_Action_80, 0); play->unk_1887C = 0; - this->csMode = PLAYER_CSMODE_NONE; + this->csAction = PLAYER_CSACTION_NONE; return true; } @@ -12902,7 +12900,7 @@ s32 func_80847880(PlayState* play, Player* this) { Player_UseItem(play, this, ITEM_BOW); } Player_AnimationPlayOnce(play, this, func_8082ED20(this)); - this->csMode = PLAYER_CSMODE_NONE; + this->csAction = PLAYER_CSACTION_NONE; this->stateFlags1 |= PLAYER_STATE1_100000; Player_StopHorizontalMovement(this); func_80836D8C(this); @@ -13192,7 +13190,7 @@ s32 func_808482E0(PlayState* play, Player* this) { play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; this->stateFlags1 &= ~PLAYER_STATE1_20000000; - func_8085B28C(play, NULL, PLAYER_CSMODE_WAIT); + func_8085B28C(play, NULL, PLAYER_CSACTION_WAIT); } this->getItemId = GI_NONE; } @@ -15455,7 +15453,7 @@ void Player_Action_43(Player* this, PlayState* play) { if (((this->unk_AA5 == PLAYER_UNKAA5_2) && !(play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON)) || ((this->unk_AA5 != PLAYER_UNKAA5_2) && - ((((this->csMode != PLAYER_CSMODE_NONE) || ((u32)this->unk_AA5 == PLAYER_UNKAA5_0) || + ((((this->csAction != PLAYER_CSACTION_NONE) || ((u32)this->unk_AA5 == PLAYER_UNKAA5_0) || (this->unk_AA5 >= PLAYER_UNKAA5_5) || func_8082FB68(this) || (this->lockOnActor != NULL) || (func_8083868C(play, this) == CAM_MODE_NORMAL) || ((this->unk_AA5 == PLAYER_UNKAA5_3) && @@ -16087,7 +16085,7 @@ void Player_Action_52(Player* this, PlayState* play) { AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.morphTable, this->skelAnime.jointTable); - if ((play->csCtx.state != CS_STATE_IDLE) || (this->csMode != PLAYER_CSMODE_NONE)) { + if ((play->csCtx.state != CS_STATE_IDLE) || (this->csAction != PLAYER_CSACTION_NONE)) { this->unk_AA5 = PLAYER_UNKAA5_0; this->actionVar1 = 0; } else if ((this->actionVar2 < 2) || (this->actionVar2 >= 4)) { @@ -16152,7 +16150,7 @@ void Player_Action_52(Player* this, PlayState* play) { } else { func_8084FD7C(play, this, &rideActor->actor); } - } else if ((this->csMode != PLAYER_CSMODE_NONE) || + } else if ((this->csAction != PLAYER_CSACTION_NONE) || (!func_8082DAFC(play) && ((rideActor->actor.speed != 0.0f) || !Player_ActionChange_4(this, play)) && !func_80847BF0(this, play) && !Player_ActionChange_13(this, play))) { if (this->lockOnActor != NULL) { @@ -16179,8 +16177,8 @@ void Player_Action_52(Player* this, PlayState* play) { } } - if (this->csMode == PLAYER_CSMODE_END) { - this->csMode = PLAYER_CSMODE_NONE; + if (this->csAction == PLAYER_CSACTION_END) { + this->csAction = PLAYER_CSACTION_NONE; } } @@ -16631,12 +16629,12 @@ void Player_Action_62(Player* this, PlayState* play) { s32 func_80851C40(PlayState* play, Player* this) { return ((play->sceneId == SCENE_MILK_BAR) && Audio_IsSequencePlaying(NA_BGM_BALLAD_OF_THE_WIND_FISH)) || - (((play->sceneId != SCENE_MILK_BAR) && (this->csMode == PLAYER_CSMODE_68)) || + (((play->sceneId != SCENE_MILK_BAR) && (this->csAction == PLAYER_CSACTION_68)) || ((play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) || (play->msgCtx.msgMode == MSGMODE_SETUP_DISPLAY_SONG_PLAYED) || (play->msgCtx.msgMode == MSGMODE_DISPLAY_SONG_PLAYED) || ((play->msgCtx.ocarinaMode != OCARINA_MODE_ACTIVE) && - ((this->csMode == PLAYER_CSMODE_5) || (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) || + ((this->csAction == PLAYER_CSACTION_5) || (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) || play->msgCtx.ocarinaAction == OCARINA_ACTION_FREE_PLAY_DONE)))); } @@ -16896,8 +16894,8 @@ void Player_Action_63(Player* this, PlayState* play) { 0, play->msgCtx.ocarinaMode); if (actor != NULL) { this->stateFlags1 &= ~PLAYER_STATE1_20000000; - this->csMode = PLAYER_CSMODE_NONE; - func_8085B28C(play, NULL, PLAYER_CSMODE_19); + this->csAction = PLAYER_CSACTION_NONE; + func_8085B28C(play, NULL, PLAYER_CSACTION_19); this->stateFlags1 |= PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000; } else { func_80836A5C(this, play); @@ -16983,7 +16981,7 @@ void Player_Action_65(Player* this, PlayState* play) { Player_StopCutscene(this); func_80848250(play, this); this->stateFlags1 &= ~PLAYER_STATE1_20000000; - func_8085B28C(play, NULL, PLAYER_CSMODE_93); + func_8085B28C(play, NULL, PLAYER_CSACTION_93); } else { s32 var_a2 = ((this->talkActor != NULL) && (this->exchangeItemAction <= PLAYER_IA_MINUS1)) || (this->stateFlags3 & PLAYER_STATE3_20); @@ -19205,7 +19203,7 @@ void func_80858D48(PlayState* play, Player* this, PlayerAnimationHeader* anim) { Player_StopHorizontalMovement(this); } -PlayerCsAnim sPlayerCsModeAnimFuncs[] = { +PlayerCsAnim sPlayerCsActionAnimFuncs[] = { NULL, // PLAYER_CSTYPE_NONE Player_CsAnim_1, // PLAYER_CSTYPE_ANIM_1 Player_CsAnim_2, // PLAYER_CSTYPE_ANIM_2 @@ -19473,290 +19471,290 @@ void func_80859300(PlayState* play, Player* this, UNK_TYPE arg2) { } } -PlayerCsModeEntry sPlayerCsModeInitFuncs[PLAYER_CSMODE_MAX] = { - /* PLAYER_CSMODE_NONE */ { PLAYER_CSTYPE_NONE, { NULL } }, - /* PLAYER_CSMODE_1 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_1 } }, - /* PLAYER_CSMODE_2 */ { PLAYER_CSTYPE_NONE, { NULL } }, - /* PLAYER_CSMODE_3 */ { PLAYER_CSTYPE_NONE, { NULL } }, - /* PLAYER_CSMODE_4 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_bikkuri } }, - /* PLAYER_CSMODE_5 */ { PLAYER_CSTYPE_NONE, { NULL } }, - /* PLAYER_CSMODE_END */ { PLAYER_CSTYPE_NONE, { NULL } }, - /* PLAYER_CSMODE_WAIT */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_1 } }, - /* PLAYER_CSMODE_8 */ { PLAYER_CSTYPE_ANIM_2, { &gPlayerAnim_link_demo_furimuki } }, - /* PLAYER_CSMODE_9 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_5 } }, - /* PLAYER_CSMODE_10 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_warp } }, - /* PLAYER_CSMODE_11 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_clink_demo_standup } }, - /* PLAYER_CSMODE_12 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_clink_demo_standup_wait } }, - /* PLAYER_CSMODE_13 */ { PLAYER_CSTYPE_ANIM_2, { &gPlayerAnim_link_demo_baru_op3 } }, - /* PLAYER_CSMODE_14 */ { PLAYER_CSTYPE_NONE, { NULL } }, - /* PLAYER_CSMODE_15 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_jibunmiru } }, - /* PLAYER_CSMODE_16 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_14 } }, - /* PLAYER_CSMODE_17 */ { PLAYER_CSTYPE_ANIM_2, { &gPlayerAnim_link_normal_okarina_end } }, - /* PLAYER_CSMODE_18 */ { PLAYER_CSTYPE_ANIM_16, { &gPlayerAnim_link_normal_hang_up_down } }, - /* PLAYER_CSMODE_19 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_16 } }, - /* PLAYER_CSMODE_20 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_1 } }, - /* PLAYER_CSMODE_21 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_clink_demo_mimawasi } }, - /* PLAYER_CSMODE_22 */ { PLAYER_CSTYPE_ANIM_6, { &gPlayerAnim_om_get_mae } }, - /* PLAYER_CSMODE_23 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_look_hand } }, - /* PLAYER_CSMODE_24 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_normal_wait_typeB_20f } }, - /* PLAYER_CSMODE_25 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_17 } }, - /* PLAYER_CSMODE_26 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_37 } }, - /* PLAYER_CSMODE_27 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_zeldamiru } }, - /* PLAYER_CSMODE_28 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_kenmiru1 } }, - /* PLAYER_CSMODE_29 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_kenmiru2 } }, - /* PLAYER_CSMODE_30 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_kenmiru2_modori } }, - /* PLAYER_CSMODE_31 */ { PLAYER_CSTYPE_ANIM_6, { &gameplay_keep_Linkanim_00D310 } }, - /* PLAYER_CSMODE_32 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_22 } }, - /* PLAYER_CSMODE_33 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_demo_rakka } }, - /* PLAYER_CSMODE_34 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_demo_pikupiku } }, - /* PLAYER_CSMODE_35 */ { PLAYER_CSTYPE_ANIM_3, { &gameplay_keep_Linkanim_00D2B8 } }, - /* PLAYER_CSMODE_36 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_25 } }, - /* PLAYER_CSMODE_37 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_27 } }, - /* PLAYER_CSMODE_38 */ { PLAYER_CSTYPE_ANIM_6, { &gameplay_keep_Linkanim_00D278 } }, - /* PLAYER_CSMODE_39 */ { PLAYER_CSTYPE_ANIM_6, { &gameplay_keep_Linkanim_00D288 } }, - /* PLAYER_CSMODE_40 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_rakuba } }, - /* PLAYER_CSMODE_41 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_bajyo_furikaeru } }, - /* PLAYER_CSMODE_42 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_okiagaru } }, - /* PLAYER_CSMODE_43 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_okiagaru_tatu } }, - /* PLAYER_CSMODE_44 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_bajyo_walk } }, - /* PLAYER_CSMODE_45 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_rakka } }, - /* PLAYER_CSMODE_46 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_sirimochi } }, - /* PLAYER_CSMODE_47 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_spotlight } }, - /* PLAYER_CSMODE_48 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_hensin } }, - /* PLAYER_CSMODE_49 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_dl_jibunmiru } }, - /* PLAYER_CSMODE_50 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_vs_yousei } }, - /* PLAYER_CSMODE_51 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_urusai } }, - /* PLAYER_CSMODE_52 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_okarinatori } }, - /* PLAYER_CSMODE_53 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_lost_horse } }, - /* PLAYER_CSMODE_54 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_lost_horse_wait } }, - /* PLAYER_CSMODE_55 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_lost_horse2 } }, - /* PLAYER_CSMODE_56 */ { PLAYER_CSTYPE_ANIM_14, { &gPlayerAnim_okarinatori } }, - /* PLAYER_CSMODE_57 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_tobikakaru } }, - /* PLAYER_CSMODE_58 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_5 } }, - /* PLAYER_CSMODE_59 */ { PLAYER_CSTYPE_ANIM_5, { &gameplay_keep_Linkanim_00D0A0 } }, - /* PLAYER_CSMODE_60 */ { PLAYER_CSTYPE_ANIM_2, { &gPlayerAnim_cl_furafura } }, - /* PLAYER_CSMODE_61 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_cl_nigeru } }, - /* PLAYER_CSMODE_62 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_ononoki } }, - /* PLAYER_CSMODE_63 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_gaku } }, - /* PLAYER_CSMODE_64 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_fuwafuwa } }, - /* PLAYER_CSMODE_65 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_fuwafuwa_modori } }, - /* PLAYER_CSMODE_66 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_elf_tobidasi } }, - /* PLAYER_CSMODE_67 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_3 } }, - /* PLAYER_CSMODE_68 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_29 } }, - /* PLAYER_CSMODE_69 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_31 } }, - /* PLAYER_CSMODE_70 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_cl_tewofuru } }, - /* PLAYER_CSMODE_71 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_jibun_miru } }, - /* PLAYER_CSMODE_72 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_hoo } }, - /* PLAYER_CSMODE_73 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_yareyare } }, - /* PLAYER_CSMODE_74 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_yes } }, - /* PLAYER_CSMODE_75 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_no } }, - /* PLAYER_CSMODE_76 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_unun } }, - /* PLAYER_CSMODE_77 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_dl_yusaburu } }, - /* PLAYER_CSMODE_78 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_dl_kokeru } }, - /* PLAYER_CSMODE_79 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_powerup } }, - /* PLAYER_CSMODE_80 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_alink_rakkatyu } }, - /* PLAYER_CSMODE_81 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_kyoro } }, - /* PLAYER_CSMODE_82 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_alink_yurayura } }, - /* PLAYER_CSMODE_83 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_somukeru } }, - /* PLAYER_CSMODE_84 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_alink_fukitobu } }, - /* PLAYER_CSMODE_85 */ { PLAYER_CSTYPE_ANIM_3, { &gameplay_keep_Linkanim_00CFC8 } }, - /* PLAYER_CSMODE_86 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_alink_tereru } }, - /* PLAYER_CSMODE_87 */ { PLAYER_CSTYPE_ANIM_5, { &gameplay_keep_Linkanim_00D1D0 } }, - /* PLAYER_CSMODE_88 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_kaitenmiss } }, - /* PLAYER_CSMODE_89 */ { PLAYER_CSTYPE_ANIM_4, { &gameplay_keep_Linkanim_00CFC0 } }, - /* PLAYER_CSMODE_90 */ { PLAYER_CSTYPE_ANIM_4, { &gameplay_keep_Linkanim_00CFB8 } }, - /* PLAYER_CSMODE_91 */ { PLAYER_CSTYPE_ANIM_4, { &gameplay_keep_Linkanim_00D050 } }, - /* PLAYER_CSMODE_92 */ { PLAYER_CSTYPE_ANIM_4, { &gameplay_keep_Linkanim_00D048 } }, - /* PLAYER_CSMODE_93 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_42 } }, - /* PLAYER_CSMODE_94 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_ozigi } }, - /* PLAYER_CSMODE_95 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_ozigi_modori } }, - /* PLAYER_CSMODE_96 */ { PLAYER_CSTYPE_ANIM_9, { &gPlayerAnim_link_normal_back_downA } }, - /* PLAYER_CSMODE_97 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_35 } }, - /* PLAYER_CSMODE_98 */ { PLAYER_CSTYPE_ANIM_15, { &gPlayerAnim_cl_maskoff } }, - /* PLAYER_CSMODE_99 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_cl_kubisime } }, - /* PLAYER_CSMODE_100 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_ee } }, - /* PLAYER_CSMODE_101 */ { PLAYER_CSTYPE_ANIM_3, { &gameplay_keep_Linkanim_00CFF0 } }, - /* PLAYER_CSMODE_102 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_40 } }, - /* PLAYER_CSMODE_103 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_45 } }, - /* PLAYER_CSMODE_104 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_dakisime } }, - /* PLAYER_CSMODE_105 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_kf_omen } }, - /* PLAYER_CSMODE_106 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_kf_dakiau } }, - /* PLAYER_CSMODE_107 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_kf_hanare } }, - /* PLAYER_CSMODE_108 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_kf_miseau } }, - /* PLAYER_CSMODE_109 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_kf_awase } }, - /* PLAYER_CSMODE_110 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_kf_tetunagu_loop } }, - /* PLAYER_CSMODE_111 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_keirei } }, - /* PLAYER_CSMODE_112 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_umanoru } }, - /* PLAYER_CSMODE_113 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_wakare } }, - /* PLAYER_CSMODE_114 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_alink_dance_loop } }, - /* PLAYER_CSMODE_115 */ { PLAYER_CSTYPE_ANIM_2, { &gPlayerAnim_link_demo_goma_furimuki } }, - /* PLAYER_CSMODE_116 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_link_uma_anim_fastrun } }, - /* PLAYER_CSMODE_117 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_umamiage } }, - /* PLAYER_CSMODE_118 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_demo_suwari1 } }, - /* PLAYER_CSMODE_119 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_demo_suwari2 } }, - /* PLAYER_CSMODE_120 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_demo_suwari3 } }, - /* PLAYER_CSMODE_121 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_7 } }, - /* PLAYER_CSMODE_122 */ { PLAYER_CSTYPE_NONE, { NULL } }, - /* PLAYER_CSMODE_123 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_9 } }, - /* PLAYER_CSMODE_124 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_clink_demo_get1 } }, - /* PLAYER_CSMODE_125 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_clink_demo_get2 } }, - /* PLAYER_CSMODE_126 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_clink_demo_get3 } }, - /* PLAYER_CSMODE_127 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_gurad } }, - /* PLAYER_CSMODE_128 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_link_demo_sita_wait } }, - /* PLAYER_CSMODE_129 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_1kyoro } }, - /* PLAYER_CSMODE_130 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_2kyoro } }, - /* PLAYER_CSMODE_131 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_sagaru } }, - /* PLAYER_CSMODE_132 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_bouzen } }, - /* PLAYER_CSMODE_133 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_kamaeru } }, - /* PLAYER_CSMODE_134 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_hajikareru } }, - /* PLAYER_CSMODE_135 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_ken_miru } }, - /* PLAYER_CSMODE_136 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_mukinaoru } }, - /* PLAYER_CSMODE_137 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_return_to_past } }, - /* PLAYER_CSMODE_138 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_last_hit_motion1 } }, - /* PLAYER_CSMODE_139 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_last_hit_motion2 } }, +PlayerCsActionEntry sPlayerCsActionInitFuncs[PLAYER_CSACTION_MAX] = { + /* PLAYER_CSACTION_NONE */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSACTION_1 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_1 } }, + /* PLAYER_CSACTION_2 */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSACTION_3 */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSACTION_4 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_bikkuri } }, + /* PLAYER_CSACTION_5 */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSACTION_END */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSACTION_WAIT */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_1 } }, + /* PLAYER_CSACTION_8 */ { PLAYER_CSTYPE_ANIM_2, { &gPlayerAnim_link_demo_furimuki } }, + /* PLAYER_CSACTION_9 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_5 } }, + /* PLAYER_CSACTION_10 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_warp } }, + /* PLAYER_CSACTION_11 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_clink_demo_standup } }, + /* PLAYER_CSACTION_12 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_clink_demo_standup_wait } }, + /* PLAYER_CSACTION_13 */ { PLAYER_CSTYPE_ANIM_2, { &gPlayerAnim_link_demo_baru_op3 } }, + /* PLAYER_CSACTION_14 */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSACTION_15 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_jibunmiru } }, + /* PLAYER_CSACTION_16 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_14 } }, + /* PLAYER_CSACTION_17 */ { PLAYER_CSTYPE_ANIM_2, { &gPlayerAnim_link_normal_okarina_end } }, + /* PLAYER_CSACTION_18 */ { PLAYER_CSTYPE_ANIM_16, { &gPlayerAnim_link_normal_hang_up_down } }, + /* PLAYER_CSACTION_19 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_16 } }, + /* PLAYER_CSACTION_20 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_1 } }, + /* PLAYER_CSACTION_21 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_clink_demo_mimawasi } }, + /* PLAYER_CSACTION_22 */ { PLAYER_CSTYPE_ANIM_6, { &gPlayerAnim_om_get_mae } }, + /* PLAYER_CSACTION_23 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_look_hand } }, + /* PLAYER_CSACTION_24 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_normal_wait_typeB_20f } }, + /* PLAYER_CSACTION_25 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_17 } }, + /* PLAYER_CSACTION_26 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_37 } }, + /* PLAYER_CSACTION_27 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_zeldamiru } }, + /* PLAYER_CSACTION_28 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_kenmiru1 } }, + /* PLAYER_CSACTION_29 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_kenmiru2 } }, + /* PLAYER_CSACTION_30 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_kenmiru2_modori } }, + /* PLAYER_CSACTION_31 */ { PLAYER_CSTYPE_ANIM_6, { &gameplay_keep_Linkanim_00D310 } }, + /* PLAYER_CSACTION_32 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_22 } }, + /* PLAYER_CSACTION_33 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_demo_rakka } }, + /* PLAYER_CSACTION_34 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_demo_pikupiku } }, + /* PLAYER_CSACTION_35 */ { PLAYER_CSTYPE_ANIM_3, { &gameplay_keep_Linkanim_00D2B8 } }, + /* PLAYER_CSACTION_36 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_25 } }, + /* PLAYER_CSACTION_37 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_27 } }, + /* PLAYER_CSACTION_38 */ { PLAYER_CSTYPE_ANIM_6, { &gameplay_keep_Linkanim_00D278 } }, + /* PLAYER_CSACTION_39 */ { PLAYER_CSTYPE_ANIM_6, { &gameplay_keep_Linkanim_00D288 } }, + /* PLAYER_CSACTION_40 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_rakuba } }, + /* PLAYER_CSACTION_41 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_bajyo_furikaeru } }, + /* PLAYER_CSACTION_42 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_okiagaru } }, + /* PLAYER_CSACTION_43 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_okiagaru_tatu } }, + /* PLAYER_CSACTION_44 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_bajyo_walk } }, + /* PLAYER_CSACTION_45 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_rakka } }, + /* PLAYER_CSACTION_46 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_sirimochi } }, + /* PLAYER_CSACTION_47 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_spotlight } }, + /* PLAYER_CSACTION_48 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_hensin } }, + /* PLAYER_CSACTION_49 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_dl_jibunmiru } }, + /* PLAYER_CSACTION_50 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_vs_yousei } }, + /* PLAYER_CSACTION_51 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_urusai } }, + /* PLAYER_CSACTION_52 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_okarinatori } }, + /* PLAYER_CSACTION_53 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_lost_horse } }, + /* PLAYER_CSACTION_54 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_lost_horse_wait } }, + /* PLAYER_CSACTION_55 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_lost_horse2 } }, + /* PLAYER_CSACTION_56 */ { PLAYER_CSTYPE_ANIM_14, { &gPlayerAnim_okarinatori } }, + /* PLAYER_CSACTION_57 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_tobikakaru } }, + /* PLAYER_CSACTION_58 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_5 } }, + /* PLAYER_CSACTION_59 */ { PLAYER_CSTYPE_ANIM_5, { &gameplay_keep_Linkanim_00D0A0 } }, + /* PLAYER_CSACTION_60 */ { PLAYER_CSTYPE_ANIM_2, { &gPlayerAnim_cl_furafura } }, + /* PLAYER_CSACTION_61 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_cl_nigeru } }, + /* PLAYER_CSACTION_62 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_ononoki } }, + /* PLAYER_CSACTION_63 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_gaku } }, + /* PLAYER_CSACTION_64 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_fuwafuwa } }, + /* PLAYER_CSACTION_65 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_fuwafuwa_modori } }, + /* PLAYER_CSACTION_66 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_elf_tobidasi } }, + /* PLAYER_CSACTION_67 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_3 } }, + /* PLAYER_CSACTION_68 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_29 } }, + /* PLAYER_CSACTION_69 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_31 } }, + /* PLAYER_CSACTION_70 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_cl_tewofuru } }, + /* PLAYER_CSACTION_71 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_jibun_miru } }, + /* PLAYER_CSACTION_72 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_hoo } }, + /* PLAYER_CSACTION_73 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_yareyare } }, + /* PLAYER_CSACTION_74 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_yes } }, + /* PLAYER_CSACTION_75 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_no } }, + /* PLAYER_CSACTION_76 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_unun } }, + /* PLAYER_CSACTION_77 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_dl_yusaburu } }, + /* PLAYER_CSACTION_78 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_dl_kokeru } }, + /* PLAYER_CSACTION_79 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_powerup } }, + /* PLAYER_CSACTION_80 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_alink_rakkatyu } }, + /* PLAYER_CSACTION_81 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_kyoro } }, + /* PLAYER_CSACTION_82 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_alink_yurayura } }, + /* PLAYER_CSACTION_83 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_somukeru } }, + /* PLAYER_CSACTION_84 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_alink_fukitobu } }, + /* PLAYER_CSACTION_85 */ { PLAYER_CSTYPE_ANIM_3, { &gameplay_keep_Linkanim_00CFC8 } }, + /* PLAYER_CSACTION_86 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_alink_tereru } }, + /* PLAYER_CSACTION_87 */ { PLAYER_CSTYPE_ANIM_5, { &gameplay_keep_Linkanim_00D1D0 } }, + /* PLAYER_CSACTION_88 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_kaitenmiss } }, + /* PLAYER_CSACTION_89 */ { PLAYER_CSTYPE_ANIM_4, { &gameplay_keep_Linkanim_00CFC0 } }, + /* PLAYER_CSACTION_90 */ { PLAYER_CSTYPE_ANIM_4, { &gameplay_keep_Linkanim_00CFB8 } }, + /* PLAYER_CSACTION_91 */ { PLAYER_CSTYPE_ANIM_4, { &gameplay_keep_Linkanim_00D050 } }, + /* PLAYER_CSACTION_92 */ { PLAYER_CSTYPE_ANIM_4, { &gameplay_keep_Linkanim_00D048 } }, + /* PLAYER_CSACTION_93 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_42 } }, + /* PLAYER_CSACTION_94 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_ozigi } }, + /* PLAYER_CSACTION_95 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_ozigi_modori } }, + /* PLAYER_CSACTION_96 */ { PLAYER_CSTYPE_ANIM_9, { &gPlayerAnim_link_normal_back_downA } }, + /* PLAYER_CSACTION_97 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_35 } }, + /* PLAYER_CSACTION_98 */ { PLAYER_CSTYPE_ANIM_15, { &gPlayerAnim_cl_maskoff } }, + /* PLAYER_CSACTION_99 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_cl_kubisime } }, + /* PLAYER_CSACTION_100 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_ee } }, + /* PLAYER_CSACTION_101 */ { PLAYER_CSTYPE_ANIM_3, { &gameplay_keep_Linkanim_00CFF0 } }, + /* PLAYER_CSACTION_102 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_40 } }, + /* PLAYER_CSACTION_103 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_45 } }, + /* PLAYER_CSACTION_104 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_dakisime } }, + /* PLAYER_CSACTION_105 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_kf_omen } }, + /* PLAYER_CSACTION_106 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_kf_dakiau } }, + /* PLAYER_CSACTION_107 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_kf_hanare } }, + /* PLAYER_CSACTION_108 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_kf_miseau } }, + /* PLAYER_CSACTION_109 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_kf_awase } }, + /* PLAYER_CSACTION_110 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_kf_tetunagu_loop } }, + /* PLAYER_CSACTION_111 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_keirei } }, + /* PLAYER_CSACTION_112 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_umanoru } }, + /* PLAYER_CSACTION_113 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_wakare } }, + /* PLAYER_CSACTION_114 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_alink_dance_loop } }, + /* PLAYER_CSACTION_115 */ { PLAYER_CSTYPE_ANIM_2, { &gPlayerAnim_link_demo_goma_furimuki } }, + /* PLAYER_CSACTION_116 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_link_uma_anim_fastrun } }, + /* PLAYER_CSACTION_117 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_umamiage } }, + /* PLAYER_CSACTION_118 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_demo_suwari1 } }, + /* PLAYER_CSACTION_119 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_demo_suwari2 } }, + /* PLAYER_CSACTION_120 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_demo_suwari3 } }, + /* PLAYER_CSACTION_121 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_7 } }, + /* PLAYER_CSACTION_122 */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSACTION_123 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_9 } }, + /* PLAYER_CSACTION_124 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_clink_demo_get1 } }, + /* PLAYER_CSACTION_125 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_clink_demo_get2 } }, + /* PLAYER_CSACTION_126 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_clink_demo_get3 } }, + /* PLAYER_CSACTION_127 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_gurad } }, + /* PLAYER_CSACTION_128 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_link_demo_sita_wait } }, + /* PLAYER_CSACTION_129 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_1kyoro } }, + /* PLAYER_CSACTION_130 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_2kyoro } }, + /* PLAYER_CSACTION_131 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_sagaru } }, + /* PLAYER_CSACTION_132 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_bouzen } }, + /* PLAYER_CSACTION_133 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_kamaeru } }, + /* PLAYER_CSACTION_134 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_hajikareru } }, + /* PLAYER_CSACTION_135 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_ken_miru } }, + /* PLAYER_CSACTION_136 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_mukinaoru } }, + /* PLAYER_CSACTION_137 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_return_to_past } }, + /* PLAYER_CSACTION_138 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_last_hit_motion1 } }, + /* PLAYER_CSACTION_139 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_last_hit_motion2 } }, }; -PlayerCsModeEntry sPlayerCsModeUpdateFuncs[PLAYER_CSMODE_MAX] = { - /* PLAYER_CSMODE_NONE */ { PLAYER_CSTYPE_NONE, { NULL } }, - /* PLAYER_CSMODE_1 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_0 } }, - /* PLAYER_CSMODE_2 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_11 } }, - /* PLAYER_CSMODE_3 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_13 } }, - /* PLAYER_CSMODE_4 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_5 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_48 } }, - /* PLAYER_CSMODE_END */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_End } }, - /* PLAYER_CSMODE_WAIT */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_2 } }, - /* PLAYER_CSMODE_8 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA70 } }, - /* PLAYER_CSMODE_9 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_6 } }, - /* PLAYER_CSMODE_10 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_15 } }, - /* PLAYER_CSMODE_11 */ { PLAYER_CSTYPE_ANIM_18, { D_8085D9E0 } }, - /* PLAYER_CSMODE_12 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_13 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_14 */ { PLAYER_CSTYPE_NONE, { NULL } }, - /* PLAYER_CSMODE_15 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_16 */ { PLAYER_CSTYPE_ANIM_17, { &gPlayerAnim_link_normal_okarina_swing } }, - /* PLAYER_CSMODE_17 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_18 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_19 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_39 } }, - /* PLAYER_CSMODE_20 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_2 } }, - /* PLAYER_CSMODE_21 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_clink_demo_mimawasi_wait } }, - /* PLAYER_CSMODE_22 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_19 } }, - /* PLAYER_CSMODE_23 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_demo_look_hand_wait } }, - /* PLAYER_CSMODE_24 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_25 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_26 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_38 } }, - /* PLAYER_CSMODE_27 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_demo_zeldamiru_wait } }, - /* PLAYER_CSMODE_28 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_demo_kenmiru1_wait } }, - /* PLAYER_CSMODE_29 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_demo_kenmiru2_wait } }, - /* PLAYER_CSMODE_30 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_demo_link_nwait } }, - /* PLAYER_CSMODE_31 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00D318 } }, - /* PLAYER_CSMODE_32 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_23 } }, - /* PLAYER_CSMODE_33 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_TranslateReverse } }, - /* PLAYER_CSMODE_34 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_35 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00D2C0 } }, - /* PLAYER_CSMODE_36 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_26 } }, - /* PLAYER_CSMODE_37 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_28 } }, - /* PLAYER_CSMODE_38 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00D280 } }, - /* PLAYER_CSMODE_39 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00D290 } }, - /* PLAYER_CSMODE_40 */ { PLAYER_CSTYPE_ANIM_18, { D_8085D9F0 } }, - /* PLAYER_CSMODE_41 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_42 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA00 } }, - /* PLAYER_CSMODE_43 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_okiagaru_wait } }, - /* PLAYER_CSMODE_44 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_32 } }, - /* PLAYER_CSMODE_45 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA2C } }, - /* PLAYER_CSMODE_46 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_sirimochi_wait } }, - /* PLAYER_CSMODE_47 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_spotlight_wait } }, - /* PLAYER_CSMODE_48 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_al_hensin_loop } }, - /* PLAYER_CSMODE_49 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_dl_jibunmiru_wait } }, - /* PLAYER_CSMODE_50 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA50 } }, - /* PLAYER_CSMODE_51 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_52 */ { PLAYER_CSTYPE_ANIM_18, { D_8085D9FC } }, - /* PLAYER_CSMODE_53 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_lost_horse_wait } }, - /* PLAYER_CSMODE_54 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_32 } }, - /* PLAYER_CSMODE_55 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA1C } }, - /* PLAYER_CSMODE_56 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_57 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA0C } }, - /* PLAYER_CSMODE_58 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_8 } }, - /* PLAYER_CSMODE_59 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_60 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA28 } }, - /* PLAYER_CSMODE_61 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_32 } }, - /* PLAYER_CSMODE_62 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_63 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_64 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_al_fuwafuwa_loop } }, - /* PLAYER_CSMODE_65 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_33 } }, - /* PLAYER_CSMODE_66 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_67 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_4 } }, - /* PLAYER_CSMODE_68 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_30 } }, - /* PLAYER_CSMODE_69 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_70 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_71 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_33 } }, - /* PLAYER_CSMODE_72 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_73 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_74 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_75 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_76 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_77 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_78 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA78 } }, - /* PLAYER_CSMODE_79 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_alink_powerup_loop } }, - /* PLAYER_CSMODE_80 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_32 } }, - /* PLAYER_CSMODE_81 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_alink_kyoro_loop } }, - /* PLAYER_CSMODE_82 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_83 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_alink_somukeru_loop } }, - /* PLAYER_CSMODE_84 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA80 } }, - /* PLAYER_CSMODE_85 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00CFD0 } }, - /* PLAYER_CSMODE_86 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_87 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_88 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_89 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_90 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_91 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_92 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_93 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_43 } }, - /* PLAYER_CSMODE_94 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_alink_ozigi_loop } }, - /* PLAYER_CSMODE_95 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_96 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_34 } }, - /* PLAYER_CSMODE_97 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_36 } }, - /* PLAYER_CSMODE_98 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_46 } }, - /* PLAYER_CSMODE_99 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_100 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_alink_ee_loop } }, - /* PLAYER_CSMODE_101 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00CFF8 } }, - /* PLAYER_CSMODE_102 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_41 } }, - /* PLAYER_CSMODE_103 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_104 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_cl_dakisime_loop } }, - /* PLAYER_CSMODE_105 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_kf_omen_loop } }, - /* PLAYER_CSMODE_106 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_kf_dakiau_loop } }, - /* PLAYER_CSMODE_107 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_kf_hanare_loop } }, - /* PLAYER_CSMODE_108 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_109 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_110 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_111 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_kei_wait } }, - /* PLAYER_CSMODE_112 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_cl_umanoru_loop } }, - /* PLAYER_CSMODE_113 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_cl_wakare_loop } }, - /* PLAYER_CSMODE_114 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_115 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_44 } }, - /* PLAYER_CSMODE_116 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_117 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_32 } }, - /* PLAYER_CSMODE_118 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_119 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_120 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_121 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_8 } }, - /* PLAYER_CSMODE_122 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_12 } }, - /* PLAYER_CSMODE_123 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_10 } }, - /* PLAYER_CSMODE_125 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_124 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_126 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_127 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_demo_gurad_wait } }, - /* PLAYER_CSMODE_128 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_129 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_L_kw } }, - /* PLAYER_CSMODE_130 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_131 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_132 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_133 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_134 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_18 } }, - /* PLAYER_CSMODE_135 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, - /* PLAYER_CSMODE_136 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_L_kennasi_w } }, - /* PLAYER_CSMODE_137 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_20 } }, - /* PLAYER_CSMODE_138 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_21 } }, - /* PLAYER_CSMODE_139 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_21 } }, +PlayerCsActionEntry sPlayerCsActionUpdateFuncs[PLAYER_CSACTION_MAX] = { + /* PLAYER_CSACTION_NONE */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSACTION_1 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_0 } }, + /* PLAYER_CSACTION_2 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_11 } }, + /* PLAYER_CSACTION_3 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_13 } }, + /* PLAYER_CSACTION_4 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_5 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_48 } }, + /* PLAYER_CSACTION_END */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_End } }, + /* PLAYER_CSACTION_WAIT */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_2 } }, + /* PLAYER_CSACTION_8 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA70 } }, + /* PLAYER_CSACTION_9 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_6 } }, + /* PLAYER_CSACTION_10 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_15 } }, + /* PLAYER_CSACTION_11 */ { PLAYER_CSTYPE_ANIM_18, { D_8085D9E0 } }, + /* PLAYER_CSACTION_12 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_13 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_14 */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSACTION_15 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_16 */ { PLAYER_CSTYPE_ANIM_17, { &gPlayerAnim_link_normal_okarina_swing } }, + /* PLAYER_CSACTION_17 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_18 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_19 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_39 } }, + /* PLAYER_CSACTION_20 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_2 } }, + /* PLAYER_CSACTION_21 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_clink_demo_mimawasi_wait } }, + /* PLAYER_CSACTION_22 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_19 } }, + /* PLAYER_CSACTION_23 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_demo_look_hand_wait } }, + /* PLAYER_CSACTION_24 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_25 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_26 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_38 } }, + /* PLAYER_CSACTION_27 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_demo_zeldamiru_wait } }, + /* PLAYER_CSACTION_28 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_demo_kenmiru1_wait } }, + /* PLAYER_CSACTION_29 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_demo_kenmiru2_wait } }, + /* PLAYER_CSACTION_30 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_demo_link_nwait } }, + /* PLAYER_CSACTION_31 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00D318 } }, + /* PLAYER_CSACTION_32 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_23 } }, + /* PLAYER_CSACTION_33 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_TranslateReverse } }, + /* PLAYER_CSACTION_34 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_35 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00D2C0 } }, + /* PLAYER_CSACTION_36 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_26 } }, + /* PLAYER_CSACTION_37 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_28 } }, + /* PLAYER_CSACTION_38 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00D280 } }, + /* PLAYER_CSACTION_39 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00D290 } }, + /* PLAYER_CSACTION_40 */ { PLAYER_CSTYPE_ANIM_18, { D_8085D9F0 } }, + /* PLAYER_CSACTION_41 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_42 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA00 } }, + /* PLAYER_CSACTION_43 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_okiagaru_wait } }, + /* PLAYER_CSACTION_44 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_32 } }, + /* PLAYER_CSACTION_45 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA2C } }, + /* PLAYER_CSACTION_46 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_sirimochi_wait } }, + /* PLAYER_CSACTION_47 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_spotlight_wait } }, + /* PLAYER_CSACTION_48 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_al_hensin_loop } }, + /* PLAYER_CSACTION_49 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_dl_jibunmiru_wait } }, + /* PLAYER_CSACTION_50 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA50 } }, + /* PLAYER_CSACTION_51 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_52 */ { PLAYER_CSTYPE_ANIM_18, { D_8085D9FC } }, + /* PLAYER_CSACTION_53 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_lost_horse_wait } }, + /* PLAYER_CSACTION_54 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_32 } }, + /* PLAYER_CSACTION_55 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA1C } }, + /* PLAYER_CSACTION_56 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_57 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA0C } }, + /* PLAYER_CSACTION_58 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_8 } }, + /* PLAYER_CSACTION_59 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_60 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA28 } }, + /* PLAYER_CSACTION_61 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_32 } }, + /* PLAYER_CSACTION_62 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_63 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_64 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_al_fuwafuwa_loop } }, + /* PLAYER_CSACTION_65 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_33 } }, + /* PLAYER_CSACTION_66 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_67 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_4 } }, + /* PLAYER_CSACTION_68 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_30 } }, + /* PLAYER_CSACTION_69 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_70 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_71 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_33 } }, + /* PLAYER_CSACTION_72 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_73 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_74 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_75 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_76 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_77 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_78 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA78 } }, + /* PLAYER_CSACTION_79 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_alink_powerup_loop } }, + /* PLAYER_CSACTION_80 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_32 } }, + /* PLAYER_CSACTION_81 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_alink_kyoro_loop } }, + /* PLAYER_CSACTION_82 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_83 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_alink_somukeru_loop } }, + /* PLAYER_CSACTION_84 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA80 } }, + /* PLAYER_CSACTION_85 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00CFD0 } }, + /* PLAYER_CSACTION_86 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_87 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_88 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_89 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_90 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_91 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_92 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_93 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_43 } }, + /* PLAYER_CSACTION_94 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_alink_ozigi_loop } }, + /* PLAYER_CSACTION_95 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_96 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_34 } }, + /* PLAYER_CSACTION_97 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_36 } }, + /* PLAYER_CSACTION_98 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_46 } }, + /* PLAYER_CSACTION_99 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_100 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_alink_ee_loop } }, + /* PLAYER_CSACTION_101 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00CFF8 } }, + /* PLAYER_CSACTION_102 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_41 } }, + /* PLAYER_CSACTION_103 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_104 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_cl_dakisime_loop } }, + /* PLAYER_CSACTION_105 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_kf_omen_loop } }, + /* PLAYER_CSACTION_106 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_kf_dakiau_loop } }, + /* PLAYER_CSACTION_107 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_kf_hanare_loop } }, + /* PLAYER_CSACTION_108 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_109 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_110 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_111 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_kei_wait } }, + /* PLAYER_CSACTION_112 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_cl_umanoru_loop } }, + /* PLAYER_CSACTION_113 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_cl_wakare_loop } }, + /* PLAYER_CSACTION_114 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_115 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_44 } }, + /* PLAYER_CSACTION_116 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_117 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_32 } }, + /* PLAYER_CSACTION_118 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_119 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_120 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_121 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_8 } }, + /* PLAYER_CSACTION_122 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_12 } }, + /* PLAYER_CSACTION_123 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_10 } }, + /* PLAYER_CSACTION_125 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_124 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_126 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_127 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_demo_gurad_wait } }, + /* PLAYER_CSACTION_128 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_129 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_L_kw } }, + /* PLAYER_CSACTION_130 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_131 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_132 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_133 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_134 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_18 } }, + /* PLAYER_CSACTION_135 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSACTION_136 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_L_kennasi_w } }, + /* PLAYER_CSACTION_137 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_20 } }, + /* PLAYER_CSACTION_138 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_21 } }, + /* PLAYER_CSACTION_139 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_21 } }, }; void Player_CsAction_0(PlayState* play, Player* this, CsCmdActorCue* cue) { @@ -19796,8 +19794,8 @@ void Player_CsAction_2(PlayState* play, Player* this, CsCmdActorCue* cue) { return; } - if ((this->csMode == PLAYER_CSMODE_20) && (play->csCtx.state == CS_STATE_IDLE)) { - func_800B7298(play, NULL, PLAYER_CSMODE_END); + if ((this->csAction == PLAYER_CSACTION_20) && (play->csCtx.state == CS_STATE_IDLE)) { + func_800B7298(play, NULL, PLAYER_CSACTION_END); } else if (this->stateFlags1 & PLAYER_STATE1_8000000) { func_80859300(play, this, 0); this->actor.velocity.y = 0.0f; @@ -19879,7 +19877,7 @@ void Player_CsAction_6(PlayState* play, Player* this, CsCmdActorCue* cue) { func_808411D4(play, this, &sp24, 0xA); this->actionVar2++; if (this->actionVar2 >= 0x15) { - this->csMode = PLAYER_CSMODE_10; + this->csAction = PLAYER_CSACTION_10; } } } @@ -20282,7 +20280,7 @@ void Player_CsAction_End(PlayState* play, Player* this, CsCmdActorCue* cue) { } } - this->csMode = PLAYER_CSMODE_NONE; + this->csAction = PLAYER_CSACTION_NONE; this->unk_AA5 = PLAYER_UNKAA5_0; } @@ -20313,9 +20311,9 @@ void Player_Cutscene_8085ABA8(Player* this, CsCmdActorCue* cue) { func_8082E784(this); } -void func_8085AC9C(PlayState* play, Player* this, CsCmdActorCue* cue, PlayerCsModeEntry* csEntry) { +void func_8085AC9C(PlayState* play, Player* this, CsCmdActorCue* cue, PlayerCsActionEntry* csEntry) { if (csEntry->type > PLAYER_CSTYPE_NONE) { - sPlayerCsModeAnimFuncs[csEntry->type](play, this, csEntry->csAnimArg2); + sPlayerCsActionAnimFuncs[csEntry->type](play, this, csEntry->csAnimArg2); } else if (csEntry->type <= PLAYER_CSTYPE_ACTION) { csEntry->csActionFunc(play, this, cue); } @@ -20326,9 +20324,9 @@ void func_8085AC9C(PlayState* play, Player* this, CsCmdActorCue* cue, PlayerCsMo } } -void func_8085AD5C(PlayState* play, Player* this, PlayerCsMode csMode) { - if ((csMode != PLAYER_CSMODE_1) && (csMode != PLAYER_CSMODE_WAIT) && (csMode != PLAYER_CSMODE_20) && - (csMode != PLAYER_CSMODE_END)) { +void func_8085AD5C(PlayState* play, Player* this, PlayerCsAction csAction) { + if ((csAction != PLAYER_CSACTION_1) && (csAction != PLAYER_CSACTION_WAIT) && (csAction != PLAYER_CSACTION_20) && + (csAction != PLAYER_CSACTION_END)) { Player_DetachHeldActor(play, this); } } @@ -20339,24 +20337,24 @@ void Player_CsAction_48(PlayState* play, Player* this, CsCmdActorCue* cue) { : play->csCtx.playerCue; s32 var_a0 = false; s32 pad; - s32 csMode; + s32 csAction; if ((play->csCtx.state == CS_STATE_IDLE) || (play->csCtx.state == CS_STATE_STOP) || (play->csCtx.state == CS_STATE_RUN_UNSTOPPABLE)) { - if ((sPlayerCsModes[this->cueId] == PLAYER_CSMODE_68) && (play->sceneId == SCENE_OKUJOU)) { + if ((sPlayerCueToCsActionMap[this->cueId] == PLAYER_CSACTION_68) && (play->sceneId == SCENE_OKUJOU)) { this->unk_AA5 = PLAYER_UNKAA5_5; if (Player_ActionChange_13(this, play)) { - this->csMode = PLAYER_CSMODE_NONE; + this->csAction = PLAYER_CSACTION_NONE; } return; } var_a0 = true; - if (sPlayerCsModes[this->cueId] != PLAYER_CSMODE_16) { - this->csMode = PLAYER_CSMODE_END; - func_800B7298(play, NULL, PLAYER_CSMODE_END); + if (sPlayerCueToCsActionMap[this->cueId] != PLAYER_CSACTION_16) { + this->csAction = PLAYER_CSACTION_END; + func_800B7298(play, NULL, PLAYER_CSACTION_END); this->cueId = PLAYER_CUEID_NONE; Player_StopHorizontalMovement(this); return; @@ -20369,36 +20367,36 @@ void Player_CsAction_48(PlayState* play, Player* this, CsCmdActorCue* cue) { } if (!var_a0 && (this->cueId != playerCue->id)) { - csMode = sPlayerCsModes[playerCue->id]; + csAction = sPlayerCueToCsActionMap[playerCue->id]; - // Negative csModes will skip this block - if ((csMode >= PLAYER_CSMODE_NONE) && !gDisablePlayerCsModeStartPos) { - if ((csMode == PLAYER_CSMODE_2) || (csMode == PLAYER_CSMODE_3)) { + // Negative csActions will skip this block + if ((csAction >= PLAYER_CSACTION_NONE) && !gDisablePlayerCsActionStartPos) { + if ((csAction == PLAYER_CSACTION_2) || (csAction == PLAYER_CSACTION_3)) { Player_Cutscene_8085ABA8(this, playerCue); } else { Player_Cutscene_SetPosAndYawToStart(this, playerCue); } } - if (csMode == PLAYER_CSMODE_108) { + if (csAction == PLAYER_CSACTION_108) { this->stateFlags3 |= PLAYER_STATE3_20000000; - } else if (csMode == PLAYER_CSMODE_110) { + } else if (csAction == PLAYER_CSACTION_110) { this->stateFlags3 &= ~PLAYER_STATE3_20000000; } D_80862B6C = this->skelAnime.moveFlags; func_8082E794(this); - func_8085AD5C(play, this, ABS_ALT(csMode)); - func_8085AC9C(play, this, playerCue, &sPlayerCsModeInitFuncs[ABS_ALT(csMode)]); + func_8085AD5C(play, this, ABS_ALT(csAction)); + func_8085AC9C(play, this, playerCue, &sPlayerCsActionInitFuncs[ABS_ALT(csAction)]); this->actionVar2 = 0; this->actionVar1 = 0; this->cueId = playerCue->id; } - csMode = sPlayerCsModes[this->cueId]; - func_8085AC9C(play, this, playerCue, &sPlayerCsModeUpdateFuncs[ABS_ALT(csMode)]); + csAction = sPlayerCueToCsActionMap[this->cueId]; + func_8085AC9C(play, this, playerCue, &sPlayerCsActionUpdateFuncs[ABS_ALT(csAction)]); if ((u16)playerCue->rot.x != 0) { Math_SmoothStepToS(&this->actor.focus.rot.x, (u16)playerCue->rot.x, 4, 0x2710, 0); @@ -20407,16 +20405,16 @@ void Player_CsAction_48(PlayState* play, Player* this, CsCmdActorCue* cue) { } void Player_Action_97(Player* this, PlayState* play) { - if (this->csMode != this->prevCsMode) { + if (this->csAction != this->prevCsAction) { D_80862B6C = this->skelAnime.moveFlags; func_8082E794(this); - this->prevCsMode = this->csMode; - func_8085AD5C(play, this, this->csMode); - func_8085AC9C(play, this, NULL, &sPlayerCsModeInitFuncs[this->csMode]); + this->prevCsAction = this->csAction; + func_8085AD5C(play, this, this->csAction); + func_8085AC9C(play, this, NULL, &sPlayerCsActionInitFuncs[this->csAction]); } - func_8085AC9C(play, this, NULL, &sPlayerCsModeUpdateFuncs[this->csMode]); + func_8085AC9C(play, this, NULL, &sPlayerCsActionUpdateFuncs[this->csAction]); } s32 Player_StartFishing(PlayState* play) { @@ -20451,15 +20449,15 @@ s32 Player_GrabPlayer(PlayState* play, Player* this) { return false; } -s32 func_8085B28C(PlayState* play, Player* this, PlayerCsMode csMode) { +s32 func_8085B28C(PlayState* play, Player* this, PlayerCsAction csAction) { Player* player = GET_PLAYER(play); if (this != NULL) { - if (csMode == PLAYER_CSMODE_NONE) { + if (csAction == PLAYER_CSACTION_NONE) { return Player_Action_36 == this->actionFunc; } - if ((this->actor.id == ACTOR_EN_TEST3) && (csMode < 0)) { + if ((this->actor.id == ACTOR_EN_TEST3) && (csAction < 0)) { func_8083B0E4(play, this, this->actor.home.rot.y); return false; } @@ -20472,7 +20470,7 @@ s32 func_8085B28C(PlayState* play, Player* this, PlayerCsMode csMode) { if ((player->actor.id == ACTOR_EN_TEST3) || !Player_InBlockingCsMode(play, player)) { func_8082DE50(play, player); Player_SetAction(play, player, Player_Action_97, 0); - player->csMode = csMode; + player->csAction = csAction; player->csActor = &this->actor; func_8082DAD4(player); @@ -20520,7 +20518,7 @@ void Player_TalkWithPlayer(PlayState* play, Actor* actor) { player->lockOnActor = actor; if (actor->textId == 0xFFFF) { - func_800B7298(play, actor, PLAYER_CSMODE_1); + func_800B7298(play, actor, PLAYER_CSACTION_1); actor->flags |= ACTOR_FLAG_TALK_REQUESTED; func_8082DE14(play, player); } else { diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c index 41c9f0692..38ef2b709 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c @@ -34,7 +34,7 @@ u32 EffectSsBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initPa { TexturePtr tex = (Rand_ZeroOne() < 0.5f) ? gEffBubble1Tex : gEffBubble2Tex; - this->gfx = VIRTUAL_TO_PHYSICAL(SEGMENTED_TO_VIRTUAL(tex)); + this->gfx = OS_K0_TO_PHYSICAL(SEGMENTED_TO_K0(tex)); } this->pos.x = ((Rand_ZeroOne() - 0.5f) * initParams->xzPosRandScale) + initParams->pos.x; diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c index 0cc62b42d..c43c01afe 100644 --- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c @@ -73,7 +73,7 @@ void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) { OPEN_DISPS(gfxCtx); - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); scale = this->rScale / 100.0f; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c index 8a4c80980..094f8bbf9 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c @@ -50,7 +50,7 @@ u32 EffectSsDtBubble_Init(PlayState* play, u32 index, EffectSs* this, void* init { TexturePtr tex = (Rand_ZeroOne() < 0.5f) ? gEffBubble1Tex : gEffBubble2Tex; - this->gfx = VIRTUAL_TO_PHYSICAL(SEGMENTED_TO_VIRTUAL(tex)); + this->gfx = OS_K0_TO_PHYSICAL(SEGMENTED_TO_K0(tex)); } Math_Vec3f_Copy(&this->pos, &initParams->pos); diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c index f8b20175b..9c6a4c341 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c @@ -37,7 +37,7 @@ u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initPar if ((objectSlot > OBJECT_SLOT_NONE) && (Object_IsLoaded(&play->objectCtx, objectSlot))) { void* segBackup = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); this->pos = params->pos; this->velocity = params->velocity; @@ -66,7 +66,7 @@ void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this) { OPEN_DISPS(play->state.gfxCtx); - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c index 312ed5f2f..93d221e09 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c @@ -40,7 +40,7 @@ u32 EffectSsSibuki_Init(PlayState* play, u32 index, EffectSs* this, void* initPa { TexturePtr tex = (KREG(2) != 0) ? gEffBubble2Tex : gEffBubble1Tex; - this->gfx = VIRTUAL_TO_PHYSICAL(SEGMENTED_TO_VIRTUAL(tex)); + this->gfx = OS_K0_TO_PHYSICAL(SEGMENTED_TO_K0(tex)); } this->life = ((s32)((Rand_ZeroOne() * (500.0f + KREG(64))) * 0.01f)) + KREG(65) + 10; diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c b/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c index b12a9cb76..543fc6e08 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c @@ -32,9 +32,9 @@ TransitionInit TransitionWipe3_InitVars = { TransitionWipe3_SetColor, TransitionWipe3_SetEnvColor, TransitionWipe3_IsDone, }; -#define TRANS3_GET_SPEED(type) (type & 1) -#define TRANS3_GET_TEX_INDEX(type) ((type >> 1) & 7) -#define TRANS3_GET_COLOR(type) ((type >> 4) & 3) +#define TRANS3_GET_SPEED(type) ((type)&1) +#define TRANS3_GET_TEX_INDEX(type) (((type) >> 1) & 7) +#define TRANS3_GET_COLOR(type) (((type) >> 4) & 3) typedef enum { /* 0 */ TRANS_WIPE3_DIR_IN, diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c index 1acb8c07a..562e1920b 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c @@ -1,11 +1,25 @@ -/* - * File: z_fbdemo_wipe4.c +/** + * @file z_fbdemo_wipe4.c * Overlay: ovl_fbdemo_wipe4 * Description: + * + * @note The bug in TransitionWipe4_Draw() makes this transition do nothing apart from increase its timer until it is + * finished. */ #include "global.h" #include "z_fbdemo_wipe4.h" +#include "sys_cfb.h" + +#define THIS ((TransitionWipe4*)thisx) + +#define TRANS4_GET_COLORTYPE(type) (((type) >> 1) & 3) +#define TRANS4_GET_SPEEDTYPE(type) ((type)&1) + +typedef enum TransitionWipe4Direction { + /* 0 */ TRANS_WIPE4_DIR_IN, + /* 1 */ TRANS_WIPE4_DIR_OUT +} TransitionWipe4Direction; void* TransitionWipe4_Init(void* thisx); void TransitionWipe4_Destroy(void* thisx); @@ -17,35 +31,115 @@ void TransitionWipe4_SetColor(void* thisx, u32 color); void TransitionWipe4_SetEnvColor(void* thisx, u32 color); s32 TransitionWipe4_IsDone(void* thisx); -#if 0 TransitionInit TransitionWipe4_InitVars = { - TransitionWipe4_Init, - TransitionWipe4_Destroy, - TransitionWipe4_Update, - TransitionWipe4_Draw, - TransitionWipe4_Start, - TransitionWipe4_SetType, - TransitionWipe4_SetColor, - TransitionWipe4_SetEnvColor, - TransitionWipe4_IsDone, + TransitionWipe4_Init, TransitionWipe4_Destroy, TransitionWipe4_Update, + TransitionWipe4_Draw, TransitionWipe4_Start, TransitionWipe4_SetType, + TransitionWipe4_SetColor, TransitionWipe4_SetEnvColor, TransitionWipe4_IsDone, }; -#endif +void TransitionWipe4_Start(void* thisx) { + TransitionWipe4* this = (TransitionWipe4*)thisx; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_Start.s") + this->isDone = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_Init.s") + switch (this->speedType) { + default: + this->baseSpeed = 0.2f; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_Destroy.s") + case 0: + this->baseSpeed = 0.1f; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_Update.s") + case 1: + this->baseSpeed = 0.05f; + break; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_Draw.s") + switch (this->colorType) { + default: + this->primColor.rgba = RGBA8(160, 160, 160, 255); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_IsDone.s") + case 0: + this->primColor.rgba = RGBA8(0, 0, 0, 255); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_SetType.s") + case 1: + this->primColor.rgba = RGBA8(160, 160, 160, 255); + break; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_SetColor.s") +void* TransitionWipe4_Init(void* thisx) { + TransitionWipe4* this = (TransitionWipe4*)thisx; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe4/TransitionWipe4_SetEnvColor.s") + bzero(this, sizeof(TransitionWipe4)); + + return this; +} + +void TransitionWipe4_Destroy(void* thisx) { +} + +void TransitionWipe4_Update(void* thisx, s32 updateRate) { + TransitionWipe4* this = (TransitionWipe4*)thisx; + + this->progress += (this->baseSpeed * 3.0f) / updateRate; + if (this->progress >= 1.0f) { + this->progress = 1.0f; + this->isDone = true; + } +} + +// Use of THIS in this function is required to match +void TransitionWipe4_Draw(void* thisx, Gfx** gfxP) { + Gfx* gfx = *gfxP; + VisFbuf* copyFx = &THIS->copyFx; + + copyFx->primColor.rgba = THIS->primColor.rgba; + + if (THIS->direction != 0) { + copyFx->scale = THIS->progress; + copyFx->lodProportion = 1.0f - THIS->progress; + } else { + copyFx->scale = 1.0f - THIS->progress; + copyFx->lodProportion = THIS->progress; + } + + //! @bug (Possibly) Since copyFx->mode is never set after being initialised to 0, the switch in VisFbuf_Draw() + //! does nothing, so this function call does nothing but change to the sprite microcode, then back to 3D microcode. + VisFbuf_Draw(copyFx, &gfx, SysCfb_GetZBuffer()); + *gfxP = gfx; +} + +s32 TransitionWipe4_IsDone(void* thisx) { + TransitionWipe4* this = (TransitionWipe4*)thisx; + + return this->isDone; +} + +void TransitionWipe4_SetType(void* thisx, s32 type) { + TransitionWipe4* this = (TransitionWipe4*)thisx; + + if (type & TRANS_TYPE_SET_PARAMS) { + this->colorType = TRANS4_GET_COLORTYPE(type); + this->speedType = TRANS4_GET_SPEEDTYPE(type); + } else if (type == TRANS_INSTANCE_TYPE_FILL_OUT) { + this->direction = TRANS_WIPE4_DIR_OUT; + } else { + this->direction = TRANS_WIPE4_DIR_IN; + } +} + +void TransitionWipe4_SetColor(void* thisx, u32 color) { + TransitionWipe4* this = (TransitionWipe4*)thisx; + + this->primColor.rgba = color; +} + +void TransitionWipe4_SetEnvColor(void* thisx, u32 color) { + TransitionWipe4* this = (TransitionWipe4*)thisx; + + this->envColor.rgba = color; +} diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h index b0aec44be..11357855a 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h @@ -3,9 +3,18 @@ #include "ultra64.h" #include "color.h" +#include "z64visfbuf.h" -typedef struct { - /* 0x00 */ char unk_0[0x28]; +typedef struct TransitionWipe4 { + /* 0x00 */ Color_RGBA8_u32 primColor; + /* 0x04 */ Color_RGBA8_u32 envColor; + /* 0x08 */ f32 baseSpeed; + /* 0x0C */ f32 progress; + /* 0x10 */ u8 direction; + /* 0x11 */ u8 colorType; + /* 0x12 */ u8 speedType; + /* 0x13 */ u8 isDone; + /* 0x14 */ VisFbuf copyFx; } TransitionWipe4; // size = 0x28 #endif diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c index ee8aa689f..8e307efd4 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c @@ -94,7 +94,7 @@ void TransitionWipe5_Draw(void* thisx, Gfx** gfxP) { G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_COPY | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); - func_8014116C(&gfx, D_0F000000, workBuffer, width, height, 1); + VisFbuf_SetBgSimple(&gfx, D_0F000000, workBuffer, width, height, VIS_FBUF_BG_CYC_COPY); } else { if (alpha == 255) { gDPSetOtherMode(gfx++, @@ -110,7 +110,7 @@ void TransitionWipe5_Draw(void* thisx, Gfx** gfxP) { gDPSetEnvColor(gfx++, 255, 255, 255, alpha); gDPSetCombineLERP(gfx++, TEXEL0, 0, ENVIRONMENT, 0, 0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0, 0, 0, 0, ENVIRONMENT); - func_8014116C(&gfx, workBuffer, D_0F000000, width, height, 0); + VisFbuf_SetBgSimple(&gfx, workBuffer, D_0F000000, width, height, VIS_FBUF_BG_CYC_1CYC); } gDPPipeSync(gfx++); gSPLoadUcode(gfx++, SysUcode_GetUCode(), SysUcode_GetUCodeData()); diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c index 1136632fb..3957466b1 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c @@ -2050,7 +2050,7 @@ void FileSelect_ConfirmFile(GameState* thisx) { Rumble_Request(300.0f, 180, 20, 100); Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); this->selectMode = SM_FADE_OUT; - func_801A4058(0xF); + Audio_MuteAllSeqExceptSystemAndOcarina(15); } else { // FS_BTN_CONFIRM_QUIT Audio_PlaySfx(NA_SE_SY_FSEL_CLOSE); this->selectMode++; // SM_FADE_OUT_FILE_INFO diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c index f8f228eaa..e61512695 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c @@ -766,7 +766,7 @@ void FileSelect_UpdateOptionsMenu(GameState* thisx) { Sram_StartWriteToFlashDefault(sramCtx); this->configMode = CM_OPTIONS_WAIT_FOR_FLASH_SAVE; } - func_801A3D98(gSaveContext.options.audioSetting); + Audio_SetFileSelectSettings(gSaveContext.options.audioSetting); return; } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index c99e6d718..0782309ca 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -4,7 +4,6 @@ * Description: Pause Menu */ -#include "prevent_bss_reordering.h" #include "z_kaleido_scope.h" #include "z64view.h" #include "overlays/gamestates/ovl_opening/z_opening.h" @@ -2861,7 +2860,7 @@ void KaleidoScope_Update(PlayState* play) { size0 = SEGMENT_ROM_SIZE(icon_item_static_syms); CmpDma_LoadAllFiles((uintptr_t)SEGMENT_ROM_START(icon_item_static_yar), pauseCtx->iconItemSegment, size0); - gSegments[0x08] = VIRTUAL_TO_PHYSICAL(pauseCtx->iconItemSegment); + gSegments[0x08] = OS_K0_TO_PHYSICAL(pauseCtx->iconItemSegment); for (itemId = 0; itemId <= ITEM_BOW_FIRE; itemId++) { if (!gPlayerFormItemRestrictions[GET_PLAYER_FORM][(s32)itemId]) { @@ -3168,7 +3167,7 @@ void KaleidoScope_Update(PlayState* play) { BgCheck_InitCollisionHeaders(&play->colCtx, play); STOP_GAMESTATE(&play->state); SET_NEXT_GAMESTATE(&play->state, TitleSetup_Init, sizeof(TitleSetupState)); - func_801A4058(0x14); + Audio_MuteAllSeqExceptSystemAndOcarina(20); gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; } @@ -3611,7 +3610,10 @@ void KaleidoScope_Update(PlayState* play) { } gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; Interface_SetHudVisibility(sUnpausedHudVisibility); - func_801A3A7C(0); + Audio_SetPauseState(false); + break; + + default: break; } diff --git a/tools/buildtools/makeyar.c b/tools/buildtools/makeyar.c index 6a241f6f5..e94ce3f0c 100644 --- a/tools/buildtools/makeyar.c +++ b/tools/buildtools/makeyar.c @@ -188,20 +188,27 @@ void createArchive(Bytearray *archive, const DataSection *dataSect) { offset = firstEntryOffset; for (i = 0; i < dataSect->symbols.len; i++) { const struct Elf32_Symbol *sym = &dataSect->symbols.symbols[i]; - size_t uncompressedSize = sym->size; - uint8_t *output = malloc(uncompressedSize * sizeof(uint8_t)); // assume compressed shouldn't be bigger than uncompressed + size_t realUncompressedSize = sym->size; + size_t alignedUncompressedSize = ALIGN16(realUncompressedSize); + uint8_t *inputBuf = malloc(alignedUncompressedSize* sizeof(uint8_t)); + uint8_t *output = malloc(alignedUncompressedSize * sizeof(uint8_t)); // assume compressed shouldn't be bigger than uncompressed size_t compressedSize; + // Make sure to pad each entry to a 0x10 boundary + memcpy(inputBuf, &dataSect->data.bytes[sym->value], realUncompressedSize); + if (realUncompressedSize < alignedUncompressedSize) { + memset(&inputBuf[realUncompressedSize], 0, alignedUncompressedSize - realUncompressedSize); + } + output[0] = 'Y'; output[1] = 'a'; output[2] = 'z'; output[3] = '0'; - util_write_uint32_be(&output[4], uncompressedSize); + util_write_uint32_be(&output[4], alignedUncompressedSize); memset(&output[8], 0, 8); compressedSize = 0x10; - assert(sym->value + uncompressedSize <= dataSect->data.size); - compressedSize += yaz0_encode(&dataSect->data.bytes[sym->value], &output[0x10], uncompressedSize); + compressedSize += yaz0_encode(inputBuf, &output[0x10], alignedUncompressedSize); // Pad to 0x10 while (compressedSize % 0x10 != 0) { diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index 56d6477ca..23539f5f0 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -70,7 +70,7 @@ 0x80087B00 : "setcause", 0x80087B10 : "sendmesg", 0x80087C60 : "pfsfreeblocks", - 0x80087E00 : "viextend", + 0x80087E00 : "viextendvstart", 0x80087E10 : "stopthread", 0x80087ED0 : "recvmesg", 0x80088010 : "setintmask", @@ -192,7 +192,7 @@ 0x80092440 : "pfsisplug", 0x80092730 : "voicegetstatus", 0x80092920 : "cartrominit", - 0x80092A80 : "guS2DInitBg", + 0x80092A80 : "us2dex", 0x80092C00 : "pfsselectbank", 0x80092C80 : "contsetch", 0x80092CE0 : "setfpccsr", @@ -259,8 +259,8 @@ 0x80097500 : "system_heap", 0x80097520 : "fp", 0x80097530 : "rand", - 0x80097540 : "osViModeNtscHpf1", - 0x80097590 : "osViModePalLan1", + 0x80097540 : "vimodentschpf1", + 0x80097590 : "vimodepallan1", 0x800975E0 : "sins", 0x80097DE0 : "exceptasm", 0x80097E10 : "thread", @@ -270,6 +270,7 @@ 0x80097E70 : "pimgr", 0x80097EA0 : "piacs", 0x80097EB0 : "contpfs", + 0x80097EB0 : "vimodentschpn1", 0x80097F10 : "seteventmesg", 0x80097F20 : "xprintf", 0x80097F70 : "timerintr", @@ -277,11 +278,11 @@ 0x80097F90 : "rotate", 0x80097FA0 : "voiceinit", 0x80097FB0 : "contramread", - 0x80097FC0 : "osViModeNtscLan1", - 0x80097FC0 : "osViModeMpalLan1", + 0x80097FC0 : "vimodentsclan1", + 0x80097FC0 : "vimodempallan1", 0x80098060 : "vi", 0x800980D0 : "cartrominit", - 0x800980E0 : "guS2DInitBg", + 0x800980E0 : "vimodefpallan1", 0x80098130 : "xldtob", 0x80098160 : "vimgr", 0x80098180 : "voicecontrolgain", @@ -307,7 +308,7 @@ 0x800992F0 : "lookathil", 0x80099300 : "xprintf", 0x80099400 : "cosf", - 0x80099450 : "__libm_qnan_f", + 0x80099450 : "libm_vals", 0x80099460 : "xldtob", 0x800994C0 : "llcvt", 0x800994D0 : "build", @@ -336,6 +337,7 @@ 0x8009E410 : "contpfs", 0x8009E510 : "seteventmesg", 0x8009E590 : "timerintr", + 0x8009E5D0 : "pfsisplug", 0x8009E610 : "cartrominit", 0x8009E690 : "vimgr", }, @@ -429,7 +431,7 @@ 0x8013EE60 : "z_view", 0x80140260 : "z_vimode", 0x80140CE0 : "z_viscvg", - 0x80140E80 : "code_80140E80", + 0x80140E80 : "z_visfbuf", 0x801418B0 : "z_vismono", 0x801420C0 : "z_viszbuf", 0x80142440 : "z_vr_box", @@ -648,7 +650,7 @@ 0x801DF090 : "z_rumble", 0x801DF0A0 : "z_view", 0x801DF0B0 : "z_vimode", - 0x801DF120 : "code_80140E80", + 0x801DF120 : "z_visfbuf", 0x801DF130 : "z_vr_box", 0x801DF150 : "z_message", 0x801DF730 : "z_message_nes", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 1b0e03401..eb21ac289 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2759,16 +2759,16 @@ 0x80140CE0:("VisCvg_Init",), 0x80140D04:("VisCvg_Destroy",), 0x80140D10:("VisCvg_Draw",), - 0x80140E80:("func_80140E80",), - 0x80140EA0:("func_80140EA0",), - 0x80140EAC:("func_80140EAC",), - 0x80141008:("func_80141008",), - 0x8014116C:("func_8014116C",), - 0x801411B4:("func_801411B4",), - 0x80141200:("func_80141200",), - 0x8014151C:("func_8014151C",), - 0x80141678:("func_80141678",), - 0x80141778:("func_80141778",), + 0x80140E80:("VisFbuf_Init",), + 0x80140EA0:("VisFbuf_Destroy",), + 0x80140EAC:("VisFbuf_DrawBgToColorImage",), + 0x80141008:("VisFbuf_SetBg",), + 0x8014116C:("VisFbuf_SetBgSimple",), + 0x801411B4:("VisFbuf_SetBgGeneral",), + 0x80141200:("VisFbuf_ApplyEffects",), + 0x8014151C:("VisFbuf_DrawGeneral",), + 0x80141678:("VisFbuf_DrawInterpolate",), + 0x80141778:("VisFbuf_Draw",), 0x801418B0:("VisMono_Init",), 0x80141900:("VisMono_Destroy",), 0x80141924:("VisMono_DesaturateTLUT",), @@ -3956,39 +3956,39 @@ 0x801A2ED8:("Audio_RestorePrevBgm",), 0x801A2F88:("Audio_PlayAmbience_StorePrevBgm",), 0x801A2FC4:("Audio_ForceRestorePreviousBgm",), - 0x801A3000:("func_801A3000",), - 0x801A3038:("func_801A3038",), + 0x801A3000:("Audio_PlayFanfareWithPlayerIOPort7",), + 0x801A3038:("Audio_MuteBgmPlayersForFanfare",), 0x801A3098:("Audio_PlayFanfare",), - 0x801A312C:("func_801A312C",), - 0x801A31EC:("func_801A31EC",), + 0x801A312C:("Audio_UpdateFanfare",), + 0x801A31EC:("Audio_PlayFanfareWithPlayerIOCustomPort",), 0x801A3238:("Audio_PlaySequenceWithSeqPlayerIO",), 0x801A32CC:("Audio_SetSequenceMode",), 0x801A3590:("Audio_UpdateEnemyBgmVolume",), - 0x801A36F0:("func_801A36F0",), + 0x801A36F0:("Audio_UpdateRomaniSinging",), 0x801A3950:("func_801A3950",), 0x801A39F8:("func_801A39F8",), - 0x801A3A7C:("func_801A3A7C",), - 0x801A3AC0:("func_801A3AC0",), + 0x801A3A7C:("Audio_SetPauseState",), + 0x801A3AC0:("Audio_UpdatePauseState",), 0x801A3AEC:("Audio_PlaySfx_PauseMenuOpenOrClose",), - 0x801A3B48:("func_801A3B48",), - 0x801A3B90:("func_801A3B90",), - 0x801A3CD8:("func_801A3CD8",), - 0x801A3CF4:("func_801A3CF4",), + 0x801A3B48:("Audio_MuteSeqPlayerBgmSub",), + 0x801A3B90:("Audio_ToggleRomaniSinging",), + 0x801A3CD8:("Audio_SetEnvReverb",), + 0x801A3CF4:("Audio_SetCodeReverb",), 0x801A3D54:("Audio_PlaySfx_SurroundSoundTest",), - 0x801A3D98:("func_801A3D98",), - 0x801A3E38:("func_801A3E38",), - 0x801A3EC0:("func_801A3EC0",), + 0x801A3D98:("Audio_SetFileSelectSettings",), + 0x801A3E38:("Audio_SetBaseFilter",), + 0x801A3EC0:("Audio_SetExtraFilter",), 0x801A3F54:("Audio_SetCutsceneFlag",), 0x801A3F6C:("Audio_PlaySfx_IfNotInCutsceneImpl",), 0x801A3FB4:("Audio_PlaySfx_IfNotInCutscene",), - 0x801A3FFC:("Audio_MuteSfxAndAmbienceSeqExceptOcarinaAndSystem",), + 0x801A3FFC:("Audio_MuteSfxAndAmbienceSeqExceptSystemAndOcarina",), 0x801A400C:("Audio_SetSpec",), - 0x801A4058:("func_801A4058",), - 0x801A41C8:("func_801A41C8",), - 0x801A41F8:("func_801A41F8",), + 0x801A4058:("Audio_MuteAllSeqExceptSystemAndOcarina",), + 0x801A41C8:("Audio_MuteSfxAndAmbienceSeqExceptSysAndOca",), + 0x801A41F8:("Audio_StopFanfare",), 0x801A429C:("Audio_StartSfxPlayer",), - 0x801A42C8:("func_801A42C8",), - 0x801A4324:("func_801A4324",), + 0x801A42C8:("Audio_DisableAllSeq",), + 0x801A4324:("Audio_GetEnabledNotesCount",), 0x801A4348:("func_801A4348",), 0x801A4380:("Audio_SetSfxVolumeExceptSystemAndOcarinaBanks",), 0x801A4428:("Audio_SetSfxReverbIndexExceptOcarinaBank",), @@ -8570,7 +8570,7 @@ 0x8099A920:("ObjSound_Init",), 0x8099A96C:("ObjSound_Destroy",), 0x8099A9A4:("ObjSound_Update",), - 0x8099AA84:("func_8099AA84",), + 0x8099AA84:("ObjSound_Draw",), 0x8099AB30:("EnCrow_Init",), 0x8099AC2C:("EnCrow_Destroy",), 0x8099AC58:("EnCrow_SetupFlyIdle",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index cf6da14e9..d1945898c 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -3857,7 +3857,7 @@ 0x801F4D48:("sCutsceneCameraInfo","UNK_TYPE","",0x80), 0x801F4DC8:("sCueTypeList","u16","[10]",0x14), 0x801F4DDC:("D_801F4DDC","UNK_TYPE1","",0x1), - 0x801F4DE0:("gDisablePlayerCsModeStartPos","UNK_TYPE1","",0x1), + 0x801F4DE0:("gDisablePlayerCsActionStartPos","UNK_TYPE1","",0x1), 0x801F4DE2:("gDungeonBossWarpSceneId","UNK_TYPE2","",0x2), 0x801F4DF0:("sSceneCutsceneList","ActorCutscene*","",0x4), 0x801F4DF4:("sSceneCutsceneCount","s16","",0x2), @@ -3981,8 +3981,8 @@ 0x801F6D10:("gTransitionTileState","UNK_TYPE4","",0x4), 0x801F6D18:("sPlayVisMono","VisMono","",0x18), 0x801F6D30:("gVisMonoColor","Color_RGBA8","",0x4), - 0x801F6D38:("D_801F6D38","UNK_TYPE1","",0x1), - 0x801F6D4C:("D_801F6D4C","UNK_TYPE4","",0x4), + 0x801F6D38:("sPlayVisFbuf","UNK_TYPE1","",0x1), + 0x801F6D4C:("sPlayVisFbufInstance","UNK_TYPE4","",0x4), 0x801F6D50:("sBombersNotebook","UNK_TYPE1","",0x1), 0x801F6DFC:("sBombersNotebookOpen","u8","",0x1), 0x801F6DFD:("sMotionBlurStatus","UNK_TYPE1","",0x1), @@ -4175,8 +4175,8 @@ 0x801FD29C:("sSfxVolumeRate","UNK_TYPE1","",0x1), 0x801FD2A0:("sRequestedSceneSeqId","UNK_TYPE1","",0x1), 0x801FD2A8:("sSfxChannelState","UNK_TYPE1","",0x1), - 0x801FD3A8:("D_801FD3A8","UNK_TYPE1","",0x1), - 0x801FD3A9:("D_801FD3A9","UNK_TYPE1","",0x1), + 0x801FD3A8:("sRomaniSingingTimer","UNK_TYPE1","",0x1), + 0x801FD3A9:("sRomaniSingingDisabled","UNK_TYPE1","",0x1), 0x801FD3AA:("sRiverSoundBgmTimer","UNK_TYPE1","",0x1), 0x801FD3AB:("sFanfareState","UNK_TYPE1","",0x1), 0x801FD3AC:("sFanfareSeqId","UNK_TYPE1","",0x1), @@ -4996,7 +4996,7 @@ 0x8085D370:("D_8085D370","UNK_TYPE1","",0x1), 0x8085D37C:("D_8085D37C","UNK_TYPE1","",0x1), 0x8085D380:("D_8085D380","UNK_TYPE1","",0x1), - 0x8085D384:("sPlayerCsModes","UNK_TYPE1","",0x1), + 0x8085D384:("sPlayerCueToCsActionMap","UNK_TYPE1","",0x1), 0x8085D3E0:("D_8085D3E0","UNK_TYPE1","",0x1), 0x8085D3F4:("D_8085D3F4","UNK_TYPE1","",0x1), 0x8085D3F8:("D_8085D3F8","UNK_TYPE1","",0x1), @@ -5084,7 +5084,7 @@ 0x8085D96C:("D_8085D96C","UNK_TYPE1","",0x1), 0x8085D978:("D_8085D978","UNK_TYPE1","",0x1), 0x8085D984:("D_8085D984","UNK_TYPE1","",0x1), - 0x8085D990:("sPlayerCsModeAnimFuncs","UNK_TYPE1","",0x1), + 0x8085D990:("sPlayerCsActionAnimFuncs","UNK_TYPE1","",0x1), 0x8085D9E0:("D_8085D9E0","UNK_TYPE1","",0x1), 0x8085D9F0:("D_8085D9F0","UNK_TYPE1","",0x1), 0x8085D9FC:("D_8085D9FC","UNK_TYPE1","",0x1), @@ -5106,8 +5106,8 @@ 0x8085DA88:("D_8085DA88","UNK_TYPE1","",0x1), 0x8085DA8C:("D_8085DA8C","UNK_TYPE1","",0x1), 0x8085DA90:("D_8085DA90","UNK_TYPE1","",0x1), - 0x8085DA94:("sPlayerCsModeInitFuncs","UNK_TYPE1","",0x1), - 0x8085DEF4:("sPlayerCsModeUpdateFuncs","UNK_TYPE1","",0x1), + 0x8085DA94:("sPlayerCsActionInitFuncs","UNK_TYPE1","",0x1), + 0x8085DEF4:("sPlayerCsActionUpdateFuncs","UNK_TYPE1","",0x1), 0x8085E354:("D_8085E354","UNK_TYPE1","",0x1), 0x8085E368:("D_8085E368","UNK_TYPE2","",0x2), 0x8085E3A4:("D_8085E3A4","UNK_TYPE1","",0x1), diff --git a/tools/namefixer.py b/tools/namefixer.py index ea6d5e19e..7abb9b282 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -6,6 +6,7 @@ import argparse # all occurrences of keys will be replaced by associated value simpleReplace = { "PLAYER_AP_": "PLAYER_IA_", + "PLAYER_CSMODE_": "PLAYER_CSACTION_", } # all occurrences of keys will be replaced by associated value, @@ -1095,7 +1096,8 @@ wordReplace = { "player->unk_386": "player->getItemDirection", "player->unk_388": "player->interactRangeActor", "player->unk_38C": "player->mountSide", - "player->unk_394": "player->csMode", + "player->csMode": "player->csAction", + "player->unk_394": "player->csAction", "player->swordQuads": "player->meleeWeaponQuads", "player->blureEffectIndex": "player->meleeWeaponEffectIndex", "player->unk_AD8": "player->underwaterTimer", @@ -1322,6 +1324,9 @@ wordReplace = { "WEEKEVENTREG_52_20": "WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE", "WEEKEVENTREG_55_80": "WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE", + "VIRTUAL_TO_PHYSICAL": "OS_K0_TO_PHYSICAL", + "SEGMENTED_TO_VIRTUAL": "SEGMENTED_TO_K0", + # Enums "TRANS_TYPE_00": "TRANS_TYPE_WIPE", "TRANS_TYPE_01": "TRANS_TYPE_TRIFORCE", @@ -1346,8 +1351,6 @@ wordReplace = { "TRANS_TYPE_20": "TRANS_TYPE_FADE_DYNAMIC", "TRANS_TYPE_21": "TRANS_TYPE_CIRCLE", "TRANS_TYPE_22": "TRANS_TYPE_WIPE5", - "PLAYER_CSMODE_6": "PLAYER_CSMODE_END", - "PLAYER_CSMODE_7": "PLAYER_CSMODE_WAIT", "SUBS_CUTSCENE_SET_UNK_LINK_FIELDS": "SUBS_CUTSCENE_WITH_PLAYER", "SUBS_CUTSCENE_SET_FLAG": "SUBS_CUTSCENE_WITH_PLAYER_SET_FLAG", diff --git a/tools/sizes/boot_functions.csv b/tools/sizes/boot_functions.csv index 47bc17b62..651eb9f08 100644 --- a/tools/sizes/boot_functions.csv +++ b/tools/sizes/boot_functions.csv @@ -241,7 +241,7 @@ asm/non_matchings/boot/printutils/Sleep_Sec.s,Sleep_Sec,0x80087AC0,0x10 asm/non_matchings/boot/setcause/__osSetCause.s,__osSetCause,0x80087B00,0x4 asm/non_matchings/boot/sendmesg/osSendMesg.s,osSendMesg,0x80087B10,0x54 asm/non_matchings/boot/pfsfreeblocks/osPfsFreeBlocks.s,osPfsFreeBlocks,0x80087C60,0x68 -asm/non_matchings/boot/viextend/osViExtendVStart.s,osViExtendVStart,0x80087E00,0x4 +asm/non_matchings/boot/viextendvstart/osViExtendVStart.s,osViExtendVStart,0x80087E00,0x4 asm/non_matchings/boot/stopthread/osStopThread.s,osStopThread,0x80087E10,0x30 asm/non_matchings/boot/recvmesg/osRecvMesg.s,osRecvMesg,0x80087ED0,0x50 asm/non_matchings/boot/setintmask/osSetIntMask.s,osSetIntMask,0x80088010,0x28 @@ -419,7 +419,7 @@ asm/non_matchings/boot/pfsisplug/__osPfsRequestData.s,__osPfsRequestData,0x80092 asm/non_matchings/boot/pfsisplug/__osPfsGetInitData.s,__osPfsGetInitData,0x80092680,0x2C asm/non_matchings/boot/voicegetstatus/__osVoiceGetStatus.s,__osVoiceGetStatus,0x80092730,0x7C asm/non_matchings/boot/cartrominit/osCartRomInit.s,osCartRomInit,0x80092920,0x58 -asm/non_matchings/boot/guS2DInitBg/guS2DInitBg.s,guS2DInitBg,0x80092A80,0x60 +asm/non_matchings/boot/us2dex/guS2DInitBg.s,guS2DInitBg,0x80092A80,0x60 asm/non_matchings/boot/pfsselectbank/__osPfsSelectBank.s,__osPfsSelectBank,0x80092C00,0x20 asm/non_matchings/boot/contsetch/osContSetCh.s,osContSetCh,0x80092C80,0x18 asm/non_matchings/boot/setfpccsr/__osSetFpcCsr.s,__osSetFpcCsr,0x80092CE0,0x4 diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 54ec93503..3a4de09ce 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -2273,16 +2273,16 @@ asm/non_matchings/code/z_vimode/func_80140970.s,func_80140970,0x80140970,0xDC asm/non_matchings/code/z_vimode/VisCvg_Init.s,VisCvg_Init,0x80140CE0,0x9 asm/non_matchings/code/z_vimode/VisCvg_Destroy.s,VisCvg_Destroy,0x80140D04,0x3 asm/non_matchings/code/z_vimode/VisCvg_Draw.s,VisCvg_Draw,0x80140D10,0x5C -asm/non_matchings/code/code_80140E80/func_80140E80.s,func_80140E80,0x80140E80,0x8 -asm/non_matchings/code/code_80140E80/func_80140EA0.s,func_80140EA0,0x80140EA0,0x3 +asm/non_matchings/code/code_80140E80/VisFbuf_Init.s,VisFbuf_Init,0x80140E80,0x8 +asm/non_matchings/code/code_80140E80/VisFbuf_Destroy.s,VisFbuf_Destroy,0x80140EA0,0x3 asm/non_matchings/code/code_80140E80/func_80140EAC.s,func_80140EAC,0x80140EAC,0x57 asm/non_matchings/code/code_80140E80/func_80141008.s,func_80141008,0x80141008,0x59 -asm/non_matchings/code/code_80140E80/func_8014116C.s,func_8014116C,0x8014116C,0x12 +asm/non_matchings/code/code_80140E80/VisFbuf_SetBgSimple.s,VisFbuf_SetBgSimple,0x8014116C,0x12 asm/non_matchings/code/code_80140E80/func_801411B4.s,func_801411B4,0x801411B4,0x13 asm/non_matchings/code/code_80140E80/func_80141200.s,func_80141200,0x80141200,0xC7 asm/non_matchings/code/code_80140E80/func_8014151C.s,func_8014151C,0x8014151C,0x57 asm/non_matchings/code/code_80140E80/func_80141678.s,func_80141678,0x80141678,0x40 -asm/non_matchings/code/code_80140E80/func_80141778.s,func_80141778,0x80141778,0x4E +asm/non_matchings/code/code_80140E80/VisFbuf_Draw.s,VisFbuf_Draw,0x80141778,0x4E asm/non_matchings/code/z_vismono/VisMono_Init.s,VisMono_Init,0x801418B0,0x14 asm/non_matchings/code/z_vismono/VisMono_Destroy.s,VisMono_Destroy,0x80141900,0x9 asm/non_matchings/code/z_vismono/VisMono_DesaturateTLUT.s,VisMono_DesaturateTLUT,0x80141924,0xC4 @@ -3473,39 +3473,39 @@ asm/non_matchings/code/code_8019AF00/Audio_PlayBgm_StorePrevBgm.s,Audio_PlayBgm_ asm/non_matchings/code/code_8019AF00/Audio_RestorePrevBgm.s,Audio_RestorePrevBgm,0x801A2ED8,0x2C asm/non_matchings/code/code_8019AF00/Audio_PlayAmbience_StorePrevBgm.s,Audio_PlayAmbience_StorePrevBgm,0x801A2F88,0xF asm/non_matchings/code/code_8019AF00/Audio_ForceRestorePreviousBgm.s,Audio_ForceRestorePreviousBgm,0x801A2FC4,0xF -asm/non_matchings/code/code_8019AF00/func_801A3000.s,func_801A3000,0x801A3000,0xE -asm/non_matchings/code/code_8019AF00/func_801A3038.s,func_801A3038,0x801A3038,0x18 +asm/non_matchings/code/code_8019AF00/Audio_PlayFanfareWithPlayerIOPort7.s,Audio_PlayFanfareWithPlayerIOPort7,0x801A3000,0xE +asm/non_matchings/code/code_8019AF00/Audio_MuteBgmPlayersForFanfare.s,Audio_MuteBgmPlayersForFanfare,0x801A3038,0x18 asm/non_matchings/code/code_8019AF00/Audio_PlayFanfare.s,Audio_PlayFanfare,0x801A3098,0x25 -asm/non_matchings/code/code_8019AF00/func_801A312C.s,func_801A312C,0x801A312C,0x30 -asm/non_matchings/code/code_8019AF00/func_801A31EC.s,func_801A31EC,0x801A31EC,0x13 +asm/non_matchings/code/code_8019AF00/Audio_UpdateFanfare.s,Audio_UpdateFanfare,0x801A312C,0x30 +asm/non_matchings/code/code_8019AF00/Audio_PlayFanfareWithPlayerIOCustomPort.s,Audio_PlayFanfareWithPlayerIOCustomPort,0x801A31EC,0x13 asm/non_matchings/code/code_8019AF00/Audio_PlaySequenceWithSeqPlayerIO.s,Audio_PlaySequenceWithSeqPlayerIO,0x801A3238,0x25 asm/non_matchings/code/code_8019AF00/Audio_SetSequenceMode.s,Audio_SetSequenceMode,0x801A32CC,0xB1 asm/non_matchings/code/code_8019AF00/Audio_UpdateEnemyBgmVolume.s,Audio_UpdateEnemyBgmVolume,0x801A3590,0x58 -asm/non_matchings/code/code_8019AF00/func_801A36F0.s,func_801A36F0,0x801A36F0,0x98 +asm/non_matchings/code/code_8019AF00/Audio_UpdateRomaniSinging.s,Audio_UpdateRomaniSinging,0x801A36F0,0x98 asm/non_matchings/code/code_8019AF00/func_801A3950.s,func_801A3950,0x801A3950,0x2A asm/non_matchings/code/code_8019AF00/func_801A39F8.s,func_801A39F8,0x801A39F8,0x21 -asm/non_matchings/code/code_8019AF00/func_801A3A7C.s,func_801A3A7C,0x801A3A7C,0x11 -asm/non_matchings/code/code_8019AF00/func_801A3AC0.s,func_801A3AC0,0x801A3AC0,0xB +asm/non_matchings/code/code_8019AF00/Audio_SetPauseState.s,Audio_SetPauseState,0x801A3A7C,0x11 +asm/non_matchings/code/code_8019AF00/Audio_UpdatePauseState.s,Audio_UpdatePauseState,0x801A3AC0,0xB asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_PauseMenuOpenOrClose.s,Audio_PlaySfx_PauseMenuOpenOrClose,0x801A3AEC,0x17 -asm/non_matchings/code/code_8019AF00/func_801A3B48.s,func_801A3B48,0x801A3B48,0x12 -asm/non_matchings/code/code_8019AF00/func_801A3B90.s,func_801A3B90,0x801A3B90,0x52 -asm/non_matchings/code/code_8019AF00/func_801A3CD8.s,func_801A3CD8,0x801A3CD8,0x7 -asm/non_matchings/code/code_8019AF00/func_801A3CF4.s,func_801A3CF4,0x801A3CF4,0x18 +asm/non_matchings/code/code_8019AF00/Audio_MuteSeqPlayerBgmSub.s,Audio_MuteSeqPlayerBgmSub,0x801A3B48,0x12 +asm/non_matchings/code/code_8019AF00/Audio_ToggleRomaniSinging.s,Audio_ToggleRomaniSinging,0x801A3B90,0x52 +asm/non_matchings/code/code_8019AF00/Audio_SetEnvReverb.s,Audio_SetEnvReverb,0x801A3CD8,0x7 +asm/non_matchings/code/code_8019AF00/Audio_SetCodeReverb.s,Audio_SetCodeReverb,0x801A3CF4,0x18 asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_SurroundSoundTest.s,Audio_PlaySfx_SurroundSoundTest,0x801A3D54,0x11 -asm/non_matchings/code/code_8019AF00/func_801A3D98.s,func_801A3D98,0x801A3D98,0x28 -asm/non_matchings/code/code_8019AF00/func_801A3E38.s,func_801A3E38,0x801A3E38,0x22 -asm/non_matchings/code/code_8019AF00/func_801A3EC0.s,func_801A3EC0,0x801A3EC0,0x25 +asm/non_matchings/code/code_8019AF00/Audio_SetFileSelectSettings.s,Audio_SetFileSelectSettings,0x801A3D98,0x28 +asm/non_matchings/code/code_8019AF00/Audio_SetBaseFilter.s,Audio_SetBaseFilter,0x801A3E38,0x22 +asm/non_matchings/code/code_8019AF00/Audio_SetExtraFilter.s,Audio_SetExtraFilter,0x801A3EC0,0x25 asm/non_matchings/code/code_8019AF00/Audio_SetCutsceneFlag.s,Audio_SetCutsceneFlag,0x801A3F54,0x6 asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_IfNotInCutsceneImpl.s,Audio_PlaySfx_IfNotInCutsceneImpl,0x801A3F6C,0x12 asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_IfNotInCutscene.s,Audio_PlaySfx_IfNotInCutscene,0x801A3FB4,0x12 -asm/non_matchings/code/code_8019AF00/Audio_MuteSfxAndAmbienceSeqExceptOcarinaAndSystem.s,Audio_MuteSfxAndAmbienceSeqExceptOcarinaAndSystem,0x801A3FFC,0x4 +asm/non_matchings/code/code_8019AF00/Audio_MuteSfxAndAmbienceSeqExceptSystemAndOcarina.s,Audio_MuteSfxAndAmbienceSeqExceptSystemAndOcarina,0x801A3FFC,0x4 asm/non_matchings/code/code_8019AF00/Audio_SetSpec.s,Audio_SetSpec,0x801A400C,0x13 -asm/non_matchings/code/code_8019AF00/func_801A4058.s,func_801A4058,0x801A4058,0x5C -asm/non_matchings/code/code_8019AF00/func_801A41C8.s,func_801A41C8,0x801A41C8,0xC -asm/non_matchings/code/code_8019AF00/func_801A41F8.s,func_801A41F8,0x801A41F8,0x29 +asm/non_matchings/code/code_8019AF00/Audio_MuteAllSeqExceptSystemAndOcarina.s,Audio_MuteAllSeqExceptSystemAndOcarina,0x801A4058,0x5C +asm/non_matchings/code/code_8019AF00/Audio_MuteSfxAndAmbienceSeqExceptSysAndOca.s,Audio_MuteSfxAndAmbienceSeqExceptSysAndOca,0x801A41C8,0xC +asm/non_matchings/code/code_8019AF00/Audio_StopFanfare.s,Audio_StopFanfare,0x801A41F8,0x29 asm/non_matchings/code/code_8019AF00/Audio_StartSfxPlayer.s,Audio_StartSfxPlayer,0x801A429C,0xB -asm/non_matchings/code/code_8019AF00/func_801A42C8.s,func_801A42C8,0x801A42C8,0x17 -asm/non_matchings/code/code_8019AF00/func_801A4324.s,func_801A4324,0x801A4324,0x9 +asm/non_matchings/code/code_8019AF00/Audio_DisableAllSeq.s,Audio_DisableAllSeq,0x801A42C8,0x17 +asm/non_matchings/code/code_8019AF00/Audio_GetEnabledNotesCount.s,Audio_GetEnabledNotesCount,0x801A4324,0x9 asm/non_matchings/code/code_8019AF00/func_801A4348.s,func_801A4348,0x801A4348,0xE asm/non_matchings/code/code_8019AF00/Audio_SetSfxVolumeExceptSystemAndOcarinaBanks.s,Audio_SetSfxVolumeExceptSystemAndOcarinaBanks,0x801A4380,0x2A asm/non_matchings/code/code_8019AF00/Audio_SetSfxReverbIndexExceptOcarinaBank.s,Audio_SetSfxReverbIndexExceptOcarinaBank,0x801A4428,0x1F